FTPTMPNAME - Set temporary upload file name |
Top Previous Next |
The FTPTMPNAME command simplifies the process of uploading files to a temporary location and then moving them to their intended destination only if the transfer is successful. This type of behavior is often required in projects that utilize multiple levels of process automation or need extra fault tolerance because an interrupted upload can leave a partial file on the remote server.
The [ prefix ] argument allows you to specify a string that will be automatically prepended to file names as the files are uploaded. The prefix is automatically removed once the upload has successfully completed. If you do not want to add a prefix then you must pass an empty string to this argument.
FTPTMPNAME "PARTIAL_" "" SENDFILE "data.xml" ;; temp file is named PARTIAL_data.xml FTPTMPNAME "/temp/" "" SENDFILE "data.xml" ;; temp file is named /temp/data.xml
The [ suffix ] argument allows you to specify a string that will be automatically appended to file names as the files are uploaded. The suffix is automatically removed once the upload has successfully completed. If you do not want to add a suffix then you must pass an empty string to this argument.
FTPTMPNAME "" ".part" SENDFILE "data.xml" ;; temp file is named data.xml.part
You can even use both [ prefix ] and [ suffix ] together:
FTPTMPNAME "/temp/" ".part" SENDFILE "data.xml" ;; temp file is named /temp/data.xml.part
On some servers, file names beginning with a period are hidden. If the server you are connecting to has this feature, you can hide temporary partial files.
FTPTMPNAME "." ".part" SENDFILE "data.xml" ;; temp file is named .data.xml.part
Call the FTPTMPNAME command omitting both the [ prefix ] and [ suffix ] to disable temporary names.
FTPTMPNAME ;; disable temp names
Related command(s): TMPNAME, SENDFILE, AUDITDB See also: Fault Tolerant Scripts |