Remove-Directory

Removes the specified directory if it does not contain any files. If the directory is not empty, it is not deleted and no error message is displayed when the installation package is executed.

The Remove-Directory command is suitable for removing any directory. In contrast, use the Remove-ShellFolder command if you want to remove system folders (for example, in the Start menu) or if you want to delete any directories including the files they contain.


Settings:

  • Path
    Path to the directory to be deleted. The use of variables is possible. Use the "..." button to select an existing directory (on the packaging system) or enter the path manually.
  • Include subdirectories
    Subdirectories are also removed if they do not contain files.
  • Also delete directory if it is not empty
    Specifies that the directory should also be deleted if it - or subdirectories of it - contain files. Files that are in use will be deleted at the next restart.
  • Use 32-Bit mode on x64 computer
    If the script is executed on a 64-bit operating system, the counterpart for 32-bit applications SysWOW64 can be used automatically when referring to the SYSTEM32 directory.


Example:

In this example, the directory C:\Test is deleted if it contains no files.


Corresponds to DSM eScript command:

  • RemoveDir


See also: