[thelist] With ASP's FileSystem Object, tell if directory is empty.

Craig cd-ml at aardvark.net.au
Tue Jul 23 09:12:01 CDT 2002


Hi all,

I've got the code below which lists all the files in a directory.  What I
don't know how to do is if the directory is empty, to simply say no files
were found.  I'm puzzled (doesn't take much :) ).

<%
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.GetFolder(server.mappath("temp\"))
for each x in fname.files
  response.write x.name & "<br>"
next
set fname=nothing
set fs=nothing
%>

Any help gladly appreciated.

Regards,
Craig.






More information about the thelist mailing list