Posts: 111
Threads: 31
Joined: Sep 2014
I am writing a macro that will automatically create a file BUT I want to limit the number of files that the folder will hold to three.
So the macro will firstly determine how many files are in the folder and create a new one IF there are only two files.
Could someone provide me with a simple example of this? (or point me to the documentation for this)
AND AS ALWAYS, this is GREATLY appreciated!
Kent
Posts: 12,073
Threads: 140
Joined: Dec 2002
Macro
Limit number file created
str folder="$my qm$\test\limit"
str fileName ;;can be eg = "*.txt"; finds all if empty
ARRAY(str) a
GetFilesInFolder a folder fileName 64
if(a.len>=3) ret
if(a.len=0) mkdir folder
str data.timeformat("{DD} {TT}") ;;put any data in the variable
data.setfile(F"{folder}\file{a.len+1}.txt")
Posts: 111
Threads: 31
Joined: Sep 2014
Shall try & work with and CAN'T THANK YOU ENOUGH!!!!!!!!!!!!
Posts: 111
Threads: 31
Joined: Sep 2014
Gintaras, SORRY to request again, but I'm away from the desk for the rest of the day & am afraid I will get stuck for the whole weekend and not be able to continue.
MY REQUEST: can you revise your above code and:
what I want to do is determine IF folder "C:\folderName" has less than 3 file
and
then simply display an 'out' message of "less than 3 files"
or
if more then simply display the message of 'more than 3'
I don't want to create a file for now. If you do this I think I can easily do the SPECIFIC file create task from my end.
THANKS AGAIN!!!!!!!!!
Posts: 12,073
Threads: 140
Joined: Dec 2002
a.len is the number of files.
if(a.len<3) out "<"
else if(a.len>3) out ">"
else out "="
Posts: 111
Threads: 31
Joined: Sep 2014