Media_DeleteItem ( item ; folderFlag )
Delete Item permanently deletes a file or folder.
Parameter | Description |
---|---|
Result | An optional target field to receive any error. Will be left empty when there is no error. |
item | The path to the folder or file to be deleted. All the contents of a folder will be deleted. |
folderFlag | When “1” or “True”, folders can be deleted. When “0” or “False”, an error will be generated if you try to delete a folder – in which case only a file can be deleted. When set to “2” a file or folder being deleted is put into trash instead of being deleted. |
Caution
Items deleted with this function cannot be recovered, unless they are put into trash with folderFlag = “2”. To protect against accidentally deleting folders, set folderFlag to “0”. If you want to have the option of recovering deleted items, you may wish to consider using folderFlag = “2”.
Examples
To delete a file named “OldShoe.doc” from the default folder:
Set Field [ MyTable::Response ;
Media_DeleteItem ( "OldShoe.doc" ;
False ) ]
To delete a folder named “Little Feet” from the default folder:
Set Field [ MyTable::Response ;
Media_DeleteItem ( "Little Feet" ;
True ) ]
To put a folder named “Garbage” located on the desktop into trash:
Set Field [ MyTable::Response ;
Media_DeleteItem ( ".D/Garbage" ; 2 ) ]