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.


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.


Tell us what you think:

  1. How to declare and work with variables in AutoIt, as well as some background information.
  2. Everything you need to know about working with minimized windows.
  3. How to set the request headers when performing HTTP requests.
  4. This Tutorial will focus on post requests in AutoIt, using the Winhttprequest.5.1 object.
  5. How to use while, for, and do until loops, and how to loop through arrays and object in AutoIt.

More in: AutoIt Tutorials