07-16-2018, 06:51 PM
I see a couple issues with this function
#1. if folder contains subfolders and has files doesn't detect it.
#2. dir is an obsolete function
Maybe something like this would be better
Function IsFolderEmpty
Macro MacroExample
this is not the only solution
Feel free to correct or improve on this function or offer different solutions
#1. if folder contains subfolders and has files doesn't detect it.
#2. dir is an obsolete function
Maybe something like this would be better
Function IsFolderEmpty
function# str'folderpath
;checks folder and its subfolders(if they exist) to see if it's empty or not
;
;REMARKS
;;folderpath- must end with a \ and be top level of folder to check(subfolders are automatically checked)
;;folderpath example- $documents$\test folder\ (test folder is the desired(TopLevel) folder to check)
;;Returns: 1 if folder is not empty, 0 if folder is empty or If folder doesn't exist
;EXAMPLES
;if IsFolderEmpty("$documents$\test folder\")
,;out "not empty"
;if !IsFolderEmpty("$documents$\test folder\")
,;out "empty"
;int ReturnValue=IsFolderEmpty("$documents$\test folder\")
;out ReturnValue
str folder.getpath(folderpath "\*")
Dir d
foreach(d folder FE_Dir 0|4|32)
,if d.dir("*.*" 0)
,,ret 1
ret 0
this is not the only solution
Feel free to correct or improve on this function or offer different solutions