REMOVEDIR method (Filesystem)
Description
Removes a specified directory, optionally showing a progress information and allowing an Undo operation.
Syntax
SuccessFlag = Exec_Method( "FILESYSTEM", "REMOVEDIR", DirName, RemoveDirOptions )
Parameters
Name | Required | Description |
---|---|---|
DirName | Yes | Specifies the path of the directory to remove. |
RemoveFilesOptions | No | Contains an @Fm-delimited dynamic array of options that control the behavior of the remove operation: <1> Allow undo <2> Allow UI <3> Parent window ID <4> Progress dialog title <5> Allow confirmations |
Returns
TRUE$ if the directory was successfully removed, or FALSE$ an error occurred. The FILEOPRESULT property may be used to obtain more details regarding the failure.
Remarks
The REMOVEDIR method is basically a wrapper around the SHFileOperation Windows API function, so it is worth examining at the documentation for this on the MSDN website to get a better idea of the capabilities of this method.
You should use fully qualified path names with this method. Using it with relative path names is not thread safe.
Equated constants for use with the REMOVEDIR method can be found in the PS_FILESYSTEM_EQUATES insert record.
Example
// Use the FILESYSTEM REMOVEDIR method to remove an entire folder and it's // contents showing any progress information, but not allowing the user to // override any conflicts. $Insert PS_FileSystem_Equates $Insert Logical DirName = "c:\my_data\aug_2017" RemoveOptions = "" RemoveOptions<PS_RMD_ALLOWUNDO$> = TRUE$ ; // Save Undo info RemoveOptions<PS_RMD_ALLOWUI$> = TRUE$ ; // Show dialogs RemoveOptions<PS_RMD_PARENTWINDOW$> = @Window RemoveOptions<PS_RMD_PROGRESSTITLE$> = "Removing data folder" RemoveOptions<PS_RMD_ALLOWCONFIRM$> = FALSE$ If Exec_Method( "FILESYSTEM", "REMOVEDIR", DirName, RemoveOptions ) Then // Removed OK End Else ErrorInfo = Get_Property( "FILESYSTEM", "FILEOPRESULT" ) ErrorCode = ErrorInfo<PS_FOR_ERRORCODE$> ErrorText = ErrorInfo<PS_FOR_ERRORTEXT$> // Handle Error .... End
See Also
N/A