MAKEFILENAME        Create a unique, non-existent file name

Top  Previous  Next

Syntax:

MAKEFILENAME

[ file name ] [ ext ] [ dir ] [ prefix ]

Arguments:

[ file name ]

A variable where the new file name is saved.

 

[ ext ]

A variable or string defining the file name extension (if [ ext ], [ dir ], and [ base ] options are omitted, .tmp is used as the default extension).

 

[ dir ]

A variable or string defining the target folder for the file (if [ dir ] and [ base ] are omitted, the current working folder is used).

 

[prefix]

A variable or string defining the desired file name prefix; a four digit number will be appended to the prefix to make it unique (if omitted robo is used).

Options:

none

 

 

 

This script command creates a unique name for a non-existent file and saves it in a specified script variable. This variable may be used in any Robo-FTP command that needs a uniquely named file. The file is not created until it is used in a command.

 

It is not required to specify [ ext ], [ dir ], or [ base ], however the arguments are position dependent, so [ base ] requires both [ ext ] and [ dir ] to be present, and [ dir ] requires [ ext ].

 

The file name returned by this command will not exist at the time the command is run, but there is no guarantee that a file of this name will not be created by some other program, so choose a naming combination that is unlikely to be used by any other program and use the file immediately after the name is generated.

 

Consider the following example in which only the [ file name ] variable is present. The file name created would resemble c:\program files\robo-ftp\roboXXXX.tmp, where XXXX would be 0001, 0002, etc. depending on whether there is a previously existing file or not.

 

;; create a unique file name in current working folder

MAKEFILENAME newfile

 

Below is an example where all four arguments are present.

 

;; create a file named "c:\temp\mailXXXX.eml"

MAKEFILENAME newfile "eml" "c:\temp" "mail"

 

 

Related Command(s): RENAME, COPY, WRITEFILE, MAKEDIR, WORKINGDIR, LISTDIR