fileerase
PATH

The fileerase statement erases a disk file or a folder, removing it from the hard disk.


Parameters

This statement has one parameter:

path – is a path to the file to be removed, including the file name (see Files and Folders for more information about file paths).


Description

This statement erases a disk file or a folder, removing it from the hard disk. When using this statement to delete files or folders, realize that you are permanently removing them from the hard disk; this statement does not move them to the Trash where they can be recovered later.

If the file to be erased has an extension, you must include the extension in the file name. If you wish to erase a Panorama X database, you must include the .pandb extension in the file name, even if it is not shown. Failure to do so will usually produce an error message but you could delete the wrong file or even an entire folder and its contents.

This example deletes a file named Addresses.pandb in the Documents folder.

fileerase "~/Documents/Addresses.pandb"

If the Documents folder had contained a folder called Addresses and you omitted the .pandb extension from the file name above, the Addresses folder would be deleted.

This example deletes a file named demo.txt in the Documents folder.

fileerase "~/Documents/demo.txt"

If the file does not exist, an error will occur. If you are not sure if the file exists, you may want to test for the error.

fileerase "~/Documents/demo.txt"
if error
    ... handle the error
endif

If the procedure issuing the fileerase cammand is in the same folder as the file to be erased, it is not necessary to specify the file path, as in this example:

fileerase "demo.txt"
Legacy Two Parameter Syntax

Previous versions of Panorama (version 6 and before) used a two parameter format for the filetrash statement:

filetrash folder,filename

For compatibility with existing databases, this format still works. Here is an example:

filetrash dbsubfolder("Logs"),datepattern(today(),"YYYYMMDD")+".log"

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0 but now uses a 1 parameter syntax and has a new name. (The old name and 2 parameter syntax is still available.)