AutoIt FileRecycle Function
The FileRecycle function is used to move files to the recycle bin for deletion.
Edited: 2017-03-26 15:26
The AutoIt FileRecycle function is used to send files to the Recycle Bin in the operating system. The function can also be used to send entire directories to the Recycle Bin, leaving nothing behind – this behavior is a little different than that of FileDelete, in that FileDelete only touches the content of the directory, leaving behind a empty folder.
You can use FileRecycleEmpty to empty the Recycle Bin if IE4+ is available on the system.
FileRecycle will only move the files to the Recycle Bin – if you want to delete the file directly, use FileDelete instead.
Returns 1 on success, and 0 on failure (can indicate that the file is in use).
AutoIt FileRecycle Example
The below example uses the (*.*) wildcard, which will match all files in the given directory.
FileRecycle("ScriptTemp\*.*")
And the following example will recycle the whole directory – including its contents – leaving nothing behind.
FileRecycle("ScriptTemp\")
You can also use Absolute Paths, this is demonstrated in the final example below.
FileRecycle("c:\ScriptTemp\")
Tell us what you think: