DELETE        Delete local file(s)

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

DELETE        Delete local file(s)

Syntax:

DELETE

[ file name ]

Arguments:

[ file name ]

Variable or string defining a file or path name; if no path is defined, Robo-FTPs working folder is used.

Options:

/force

Delete files even if they have read-only permissions set.

 

/on_filedeleted=xx

Specifies a function name to be invoked on each file to be deleted

 

 

This script command deletes the specified local file or files. This is an example of the DELETE command:

 

DELETE "file name"

 

Wildcard file names are allowed with the DELETE command. For example, the following command deletes all files with an extension of .html from a local folder named c:\mysite.

 

DELETE "c:\mysite\*.html"

 

 

To delete file(s) on the FTP site, use the FTPDELETE script command.  Use the DELDIR command to delete an empty local directory.

 

After any files have been deleted, the %deletefiles internal script variable is automatically populated with the filenames of all such files.

 

Using /on_filedelete

 

When using the /on_filedeleted=xx option, xx must be the name of a previously defined function. This function must use the following structure:

 

    FUNCTION ondeletefun path fullpath datetime size err errmsg

    ...

    ENDFUNCTION

 

The arguments are as follows:

path

name of the file that was deleted

fullpath

full path to the file that was deleted

datetime

last modified datetime of the file using the same syntax as Robo-FTP's %datetime variable

size

size of the file, in bytes

err

numeric error code in case the file was not deleted, or $ERROR_SUCCESS otherwise

errmsg

the associated error message corresponding to the error code above

 

If the function returns $ERROR_SUCCESS, the DELETE command will proceed to delete additional files. If the return value is anything else, the DELETE command will immediately abort.

 

Related command(s): COPY, APPEND, RENAME, WORKINGDIR, Using the %deletefiles and %ftpdeletefiles Variables