
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
check if DIR exists
hi all,
is there a way i can check if a directory exists, if it doesn't then create it?
I would like this done in the script
- Tags:
- new_to_qlikview


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
En the script, you can use
//verify existence of a directory.
if (FileTime('PATH') > 0 ) then
//exist
else
//if not exist.
EXECUTE cmd.exe /c mkdir PATH
endif
This will use the CMD of windows, so you will need the proper permission to the application to this work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thanks. would that make it dynamic though?
currently i have a loop in my script which reads DBF files from multiple directories.
so when QV reads the 1st dir and reads in each DBF i want it to check that there is a folder named 'Processed'. i then want to move the DBF's into the processed folder.
but obviously i can't hardcode a directory into the CMD.
Does that make sense?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can make it dinamic.
You could do something like this:
//Load a Table with the path you want to ceck. This could be done from a .xlxs ,etc
DIRECTORYS:
LOAD * INLINE [
Dirs
dir1
dir2
dir3
];
let vNroDir= NoOfRows('DIRECTORYS');
for i = 0 to $(vNroDir) - 1
let vDir = Peek('Dirs',$(i),'DIRECTORYS');
if (FileTime('$(vDir)') > 0 ) then
//exist
else
//if not exist.
EXECUTE cmd.exe /c mkdir $(vDir)
endif
next i
