Folder.DeleteTree

Folder.DeleteTree (

string FolderName,

function CallbackFunction = nil )

Example 1

Folder.DeleteTree("C:\\TargetFolder", nil);

Deletes the folder called "TargetFolder" and all of its contents.

Example 2

-- Display a browse dialog so they can select a folder they want deleted.
target_folder = Dialog.FolderBrowse("Locate Folder", _DesktopFolder);

if (target_folder ~= "CANCEL") and (target_folder ~= "") then
-- Ask the user to confirm the deletion of the folder and its contents.
result = Dialog.Message("IMPORTANT", "Are you sure you wish to delete the folder located at "..target_folder.."?\r\n\r\nClicking 'Yes' will remove the folder and all of its contents.", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);

if (result == IDYES) then
-- Show the status dialog.
StatusDlg.Show();

-- Delete the target folder and all of its contents.
Folder.DeleteTree(target_folder);

-- Hide the status dialog.
StatusDlg.Hide();
end
end

A folder browse dialog is displayed allowing the user to select a folder they wish to delete. Once selected, the user is presented with a confirmation dialog explaining the implications of the action. If they click the "Yes" button, the target folder and all of its contents are deleted.

See also: Related Actions