AutoIt FileDelete Function

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

3107 views

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

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