FIL. - File-Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Filesystem-Commands > FIL. - File-Commands >

FIL. - File-Commands

FIL.Find free Number

Previous Top Next


MiniRobotLanguage (MRL)

 

FIL.ffn

FIL.Find free Number

Find the next free number in a series of numbered files or folders

 

NTFS-Direct

 

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.

 

fil_gnffil_gnf_2

 

 

 

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:

 

    Split File

    Join File

    OPT. - Optional Settings

    GEC. - Get Encryption

    RMD. - Remove-Directory

    ATF - Append-to-File

    CFF. - Copy-From-File

    CTF - Copy-To-File

    COP. - Copy File

    SHF. - Shell-File-Operation

    MDF. - Make-Direktory-File

    MKD. - Make-Directory

    GLC. - Get-Line-Count

    IEF. / NEF. - If - exist - File

    LFF - Line-From-File

    WFF. - Wait-For-File

    REN. - Rename File/Dir