Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOW-TO Limit the number of files created
#1
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
#2
Macro Limit number file created
Code:
Copy      Help
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")
#3
Shall try & work with and CAN'T THANK YOU ENOUGH!!!!!!!!!!!!
#4
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!!!!!!!!!
#5
a.len is the number of files.

if(a.len<3) out "<"
else if(a.len>3) out ">"
else out "="
#6
THANK YOU AGAIN!


Forum Jump:


Users browsing this thread: 1 Guest(s)