ezzetabi Posted April 5, 2004 Share Posted April 5, 2004 How can I do this? ($folder DO have the trailing \) FileExists($folder & "*.*") always returns 1! Link to comment Share on other sites More sharing options...
bcording Posted April 5, 2004 Share Posted April 5, 2004 Try this...It returns 1 if empty, 0 if not, and -1 if directory does not exist. Func DirIsEmpty($Dir) Local $Search, $i, $File If StringRight($Dir,1) <> "\" then $Dir = $Dir & "\" $Search = FileFindFirstFile($Dir & "*.*") If $Search = -1 Then Return -1 While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop $i= $i + 1 If $i > 2 then ExitLoop WEnd FileClose($Search) If $i = 2 then Return 1 EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now