Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting files

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
A trap for the unwary Windows user:

When counting files in a directory using

set fileSYS=server.createObject("scripting.FileSystemObject")
set folderName = fileSYS.GetFolder("/temp") '(or wherever)
set allFiles = foldername.files

If there are (say) 10 files in the folder, allfiles.count returns a value of
12!

It had me confused for about a minute until I realised it must be counting
"." and ".." as files also - which makes sense as DOS treats them as files.

So the real number of files will be allfiles.count - 2
Steve Davis
hey.you@hahaha.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top