By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

AutoIt FileDelete Function

Reference on the FileDelete AutoIt Function. How to use the Function, and useful example scripts.

Edited: 2015-02-13 00:10

The AutoIt FileDelete Function is used to delete files. If a directory path is supplied, all files within the given directory will be deleted, leaving behind a empty folder – this behavior is different than that of FileRecycle, wheres the folder will be moved as well as its contents.

FileDelete will attempt to delete the file directly – if you want to move the file to the Recycle Bin, use FileRecycle instead.

Returns 1 on success, and 0 on failure (can indicate that the file is in use).

AutoIt FileDelete Example

The below example will delete all .txt files from a directory.


You can also use absolute paths, how to do that is shown below.