By using this site you agree to the use of cookies.

Learn more

Share via:

AutoIt FileDelete Function

The FileDelete function is used to delete files directly, without moving them to the recycle bin.

Edited: 2017-03-26 15:19

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).

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

FileDelete("SomeTestDirectory\*.txt")

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

FileDelete("c:\SomeTestDirectory\*.txt")