Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If a folder is not empty, do something
#8
Kevin you're right, "dir" is now obsolete. So now I update my "IsFileExist" function to this:
Function IsFileExist
Code:
Copy      Help
function# str'file

Dir d; str s
foreach(d _s.expandpath(file) FE_Dir 0|4|32)
,s = d.FileName
,if s.len
,,ret 1
ret 0

Macro IsFileExist Test
Code:
Copy      Help
out
;Note: folders ("c:\x1" and "d:\z1" are just empty folders for testing only.
str files=
;c:\*
;c:\temp\*.csv
;c:\temp\*.htm
;c:\temp\*.txt
;c:\temp\*.docx
;c:\x1\*
;d:\*
;d:\download\*.apk
;d:\download\*.epub
;d:\download\*.mobi
;d:\download\*.pdf
;d:\download\*.txt
;d:\download\*.rar
;d:\z1\*

str file
foreach file files
,if IsFileExist(file)
,,out F"{file} exist."
,else
,,out F"{file} is NONE!"


Messages In This Thread
RE: If a folder is not empty, do something - by Start_Learning - 07-17-2018, 03:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)