That should work well with minor modification. I am not sure what is the most efficient; to first filter on date and then on the name, like in the example below, or in the reverse order. You could try both and compare the performance.
filepath = filepath = "K:\...\PROBER_01\";
prefilelist = Files In Directory(filepath);
n2 = N Items(prefilelist);
datelimit = Today() - In Days(30);
filelist = {};
For(i2 = 1, i2 <= n2, i2++,
file = prefilelist[i2];
If(Last Modification Date(filepath || file) > datelimit,
If(
Word(3, file, "_") == "DRIE" &
Word(2, file, "_") == "ILGO1" &
Substr(file, 5, 1) == "L" &
Substr(file, 1, 1) == "G",
Insert Into(filelist, file);
Show(file);
)
);
);
Hi MS,
Your solution works very well thank you.
FYI:
I made two versions for testing purposes as you suggested:
the first version creates the filelist in 1 minute 50 seconds.
filepath = "K:\...\PROBER_01\";
prefilelist = Files In Directory(filepath);
n2 = N Items(prefilelist);
datelimit = Today() - In Days(30);
filelist = {};
For(i2 = 1, i2 <= n2, i2++,
file = prefilelist[i2];
If(Last Modification Date(filepath || file) > datelimit,
If(
Word(3, file, "_") == "DRIE" &
Word(2, file, "_") == "ILGO1" &
Substr(file, 5, 1) == "L" &
Substr(file, 1, 1) == "G",
Insert Into(filelist, file);
Show(file);
);
);
the second version creates the same filelist in 20 seconds.
filepath = "K:\....\PROBER_01\";
prefilelist = Files In Directory(filepath);
n2 = N Items(prefilelist);
datelimit = Today() - In Days(30);
filelist = {};
For(i2 = 1, i2 <= n2, i2++,
file = prefilelist[i2];
If(
Word(3, file, "_") == "DRIE" &
Word(2, file, "_") == "ILGO1" &
Substr(file, 5, 1) == "L" &
Substr(file, 1, 1) == "G",
If(Last Modification Date(filepath || file) > datelimit,
Insert Into(filelist, file);
Show(file);
);
);
Best Regards,
Philip