Re: Count Files and Folders
- From: "ServerMonkey" <anonymous@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Jun 2005 16:36:48 -0500
Hey thanks very much!
I hacked the script a little to also include the total number of folders,
which I also needed:
Dim totFileCount, totFolderCount
Set fs = CreateObject("Scripting.FileSystemObject")
startFolder = "C:\"
totFileCount = fs.GetFolder(startFolder).Files.Count
CountSubfolderFiles fs.GetFolder(startFolder)
CountSubfolderFolders fs.GetFolder(startFolder)
Wscript.echo "TOTAL FILES = ", totFileCount
Wscript.echo "TOTAL FOLDERS = ", totFolderCount
Wscript.Quit
Sub CountSubfolderFiles(Folder)
For Each Subfolder in Folder.SubFolders
totFileCount = totFileCount + SubFolder.Files.Count
CountSubfolderFiles Subfolder
Next
End Sub
Sub CountSubfolderFolders(Folder)
For Each Subfolder in Folder.SubFolders
WScript.Echo Folder.Path
totFolderCount = totFolderCount + 1
CountSubfolderFolders Subfolder
Next
End Sub
"Ato Bisda" <atobisda@xxxxxxxxx> wrote in message
news:e1LlVtfbFHA.2984@xxxxxxxxxxxxxxxxxxxxxxx
> http://forums.techarena.in/archive/index.php/t-77893.html
>
> "ServerMonkey" <anonymous@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:42a9f535$1@xxxxxxxxxxxxxxxxxxxxxx
> > This should be really easy, but can't seem to do it. I'm needing a
script
> > that counts the number of files and folders on a local disk.
> >
> >
>
>
.
- Follow-Ups:
- Re: Count Files and Folders
- From: Dave R
- Re: Count Files and Folders
- References:
- Count Files and Folders
- From: ServerMonkey
- Re: Count Files and Folders
- From: Ato Bisda
- Count Files and Folders
- Prev by Date: Re: Count Files and Folders
- Next by Date: Re: Finding name of a file in a directory
- Previous by thread: Re: Count Files and Folders
- Next by thread: Re: Count Files and Folders
- Index(es):
Relevant Pages
|