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.
And the following example will recycle the whole directory – including its contents – leaving nothing behind.
You can also use Absolute Paths, this is demonstrated in the final example below.