8.9.4 IsEmptyDir (check whether a folder is empty)
- Purpose
-
Checks whether a folder is empty and returns True or False.
- Syntax
IsEmptyDir (DirName)
- Argument
-
- DirName
-
Specify the folder name as a string or as a variable that stores this value.
- Description
-
The IsEmptyDir command checks whether the specified folder contains any files or folders. The command returns True if the folder is empty, or False if not. Note, however, that if you do not have access permissions to read the specified folder, the command returns True even if the folder is not empty.
False is always returned if you specify a non-existent folder.
- Note
-
Take care when specifying the folder, or a folder in the folder set in the following environment variables: ProgramFiles (normally the Program Files folder on the system drive) and WinDir (normally the Windows folder on the system drive). For details, see 1.8.3 Effect of the executing user on command behavior.
- Example
' Check whether folder "BKUP" is empty. outDir = _SCF_+"BKUP\" If IsExistDir (outDir) = True Then If IsEmptyDir (outDir) = True Then MessageBox ("Empty !") Else MessageBox ("Not Empty!") End Else MessageBox ("Not Exist!") End
- JP1/Script version
-
Supported from JP1/Script 01-00.