<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > FIL. - File-Commands > FIL. - File-Commands |
MiniRobotLanguage (MRL)
FIL.ffn
FIL.Find free Number
Find the next free number in a series of numbered files or folders
Intention
This command is used to find the next free number in a series of Files or Folders with a builtin Number.
Generally the "?" in the Filename is replaced with the number during the process.
$$MSG=Teste FIL "FFN Part 2".
$$LAB=$$LAAFile_?.txt
$$LAC=
' Create series of 10 files
FIL.gnf|$$LAB|$$LAC|1|5|3|1
VAR.$$LAE=$tos$
MBX. Created $$LAE files
$$LAC=1
$$LAD=3
$$LAE=0
FIL.ffn|$$LAB|$$LAC|$$LAD|$$LAE
'JIV.$$LAE!11|Lab_failed
MBX.Next Free Filenumber is: $$LAE
This is how such "Numbered files" or folders do look.
Syntax
FIL.ffn|P1|P2[|P3][|P4][|P5]
FIL.find free number|P1|P2[|P3][|P4][|P5]
Parameter Explanation
P1 - Filename and Path to the first numbered file, it must contain a "?".
The "?" will be replaced with the formatted Number during the process.
If P1 ends with a \ then its taken as a folder-name.
P2 - (optional,numeric) Variable or value with the first number (starting number).
P3 - (optional,numeric) Variable or value with number of digits to format the number.
0/1 - do not format the numbers, e.g. File_2.txt
2 and higher: - format with number of digits in P3,
Default: Numbers will not be formatted.
P4 - (numeric) Variable with the result of the operation, that is a number between P1 and more.
If the last file that was found was File_010.txt, then this result will just be "11".
Speed in Ticks:
This command uses typically around 2150 Ticks.
Example
'*****************************************************
' EXAMPLE 2: FIL.ffn
'*****************************************************
$$MSG=Teste FIL "FFN".
$$LAB=$$LAAFile_?.txt
$$LAC=
' Create series of 10 files
FIL.gnf|$$LAB|$$LAC|1|5|3|1
VAR.$$LAE=$tos$
MBX. Created $$LAE files
$$LAC=1
$$LAD=3
$$LAE=0
FIL.ffn|$$LAB|$$LAC|$$LAD|$$LAE
'JIV.$$LAE!11|Lab_failed
MBX.Next Free Filenumber is: $$LAE
ENR.
Remarks
Can acess very large pathes up to 32767 characters due to the use of NTFS-direct.
Limitations:
-
See also:
• IEF. / NEF. - If - exist - File