Removes a file or directory from a server, or removes a file from your system.
Built-in Message handler[edit | edit source]
Wooxly, Uttar Pradesh (vymaps.com)
Synonyms: clear URL
delete URL "ftp://me:email@example.com/trash/"
answer file "Select the file you wish to delete." put it into tFileToDelete delete URL ("file:" & tFileToDelete)
Use the delete URL command to remove a file.
The URLtoDelete specifies the name and location of the file or directory to delete, in the form of a URL.
Comments: If the file or directory is successfully deleted, the result function is set to empty. Otherwise, the result function returns an error message.
You can use a file or binfile URL to delete a file, but not a folder. To remove a folder from your system, use the delete folder command. (You can also use the delete file command to delete a local file.)
This command can also be used to remove files and directories your stack did not create. Of course, a stack should not remove data it didn't create without obtaining explicit confirmation from the user.
Normally, FTP servers do not allow anonymous users to delete files, for obvious reasons. This means that while an ftp URL without a user name and password is valid, you will almost always need a user name and password to use the delete URL command.
Note: When used with an ftp or httpURL, the delete URL command is blocking: that is, the handler pauses until LiveCode is finished deleting the URL. Since deleting a file from a server may take some time due to network lag, the delete URL command may take long enough to be noticeable to the user.
If a blocking operation involving a URL (using the put command to upload a URL, the post command, the delete URL command, or a statement that gets an ftp or http URL) is going on, no other blocking URL operation can start until the previous one is finished. If you attempt to use a URL in an expression, or put data into a URL, while another blocking URL operation is in progress, the result is set to "Error Previous request not completed".
The delete URL command is part of the Internet library. To ensure that the command works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions section of the Standalone Application Settings window, make sure "Internet Library" is selected in the list of script libraries.
When included in a standalone application, the Internet library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the delete URL command is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCard handlers in the main stack. Once the application has finished starting up, the library is available and the delete URL command can be used in any handler.