Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a very simple script loading every QVX file from all sub-directories of a directory.
directory;
for each dir_name in DirList('*')
load * from $(dir_name)\*.qvx (qvx);
NEXT;
There are some sub-directories (for example 'bar','baz','foobar') I want to exclude from that DirList.
How would you go about it?
This is what worked for me. Note the single quotes around the sub-directory variable and sub-directories to be excluded.
Also I can use QvWorkPath because there is a "directory;" statement just before.
directory;
FOR Each dir_name in DirList('*')
IF match('$(dir_name)','$(QvWorkPath)\bar','$(QvWorkPath)\baz','$(QvWorkPath)\foobar')= 0 then
load * from $(dir_name)\*.qvx (qvx);
END IF;
NEXT;
You will need a list of these directories which you want or which you not want - which one is shorter? Then you could use outside from your loop another loop or call these loop. Another possibility could be a if-loop inside your loop to check if these folder in your list or not.
- Marcus
Isn't there a coding pattern on how to kick out list elements from a list?
This seems better style to me.
directory;
for each dir_name in DirList('*')
if match($(dir_name), 'bar','baz','foobar') = 0 then
load * from $(dir_name)\*.qvx (qvx);
end if
NEXT;
This is what worked for me. Note the single quotes around the sub-directory variable and sub-directories to be excluded.
Also I can use QvWorkPath because there is a "directory;" statement just before.
directory;
FOR Each dir_name in DirList('*')
IF match('$(dir_name)','$(QvWorkPath)\bar','$(QvWorkPath)\baz','$(QvWorkPath)\foobar')= 0 then
load * from $(dir_name)\*.qvx (qvx);
END IF;
NEXT;