Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.5.11 DeleteDir (delete a folder)

Purpose

Deletes a folder.

Syntax
DeleteDir (DirPath [, Option])
Arguments
DirPath

Write the folder path to be deleted, using a character string or a variable that stores this value.

Option (from version 06-00)

Specify either of the following values:

Value

Meaning

Anyway

Delete the entire folder even if it contains files.

IfEmpty

Delete the folder only if it is empty. False is returned as the command execution result if the folder is not deleted.

This value is optional. If you omit this value, Anyway is assumed.

Description

The DeleteDir command deletes the specified folder. The command returns True on successful execution, or False if an error occurs. True is also returned if you specify a non-existent folder.

Note

Take care when specifying a folder in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.2 Command behavior.

Important note

Take care in using this command. If you do not specify If Empty, the entire folder will be deleted even if it contains files.

Examples
' Unconditionally delete the folder "HITACHI" in the
' Windows folder.
DeleteDir (_WIN_+"HITACHI")
 
' Delete the folder "HITACHI" in the Windows folder if
' it is empty.
DeleteDir (_WIN_+"HITACHI", IfEmpty)
JP1/Script version

Supported from JP1/Script 01-00.