File.delete

From MiniScript Wiki
Revision as of 17:08, 12 July 2021 by JoeStrout (talk | contribs) (Created page with "The <c>file.delete</c> method deletes a file or empty directory from disk. === Arguments === {| class="wikitable" |- ! Parameter Name !! Default Value !! Meaning |- | pa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The file.delete method deletes a file or empty directory from disk.

Arguments

Parameter Name Default Value Meaning
path "" file name, partial path, or absolute path to file or directory to be deleted

If given a file name or partial path, it will be interpreted relative to the current working directory (see file.curdir).

Result

If the file was successfully deleted, this method returns true (1). Otherwise, it returns false (0). This can happen if the specified file does not exist, if it is a directory that is not empty, or if some other low-level issue occurs (for example, the file is locked).

Example

The following attempts to delete a file called "test.txt" in the current directory.

file.delete "test.txt"