guides:programming:programmers_reference_manual:removedir_method_filesystem

REMOVEDIR method (Filesystem)

Removes a specified directory, optionally showing a progress information and allowing an Undo operation.

 
SuccessFlag = Exec_Method( "FILESYSTEM",    
                           "REMOVEDIR",     
                            DirName,         
                            RemoveDirOptions )
NameRequiredDescription
DirNameYesSpecifies the path of the directory to remove.
RemoveFilesOptionsNoContains 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

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.

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.

 
// 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
 
 
 

N/A

  • guides/programming/programmers_reference_manual/removedir_method_filesystem.txt
  • Last modified: 2023/10/25 10:50
  • by 127.0.0.1