Need to count the number of files in a directory on a Windows 2003 server ? Here’s the command that can easily be scripted:
dir/b/a-d c:\directory | find /v /c “::”
You can also specify a file share instead of a directory name:
dir/b/a-d \\server\share | find /v /c “::”
If you want to count the number of files in a directory and all subdirectories, the command is:
dir/s/b/a-d \c:\directory | find /v /c “::”
Carsten Siemens edited Revision 3. Comment: Pirated Content - see my comment
Richard Mueller edited Revision 2. Comment: Changed tags "Windows 2008" and "Windows 2003" to "Windows Server 2008" and "Windows Server 2003"
Ed Price - MSFT edited Original. Comment: Title casing, font style
perfect!
NOTE: This article was reported as Pirated/Plagiarized Content (content you didn't write) and will be removed. Please do not steal content from others. If you feel we are mistaken, please leave a comment or email tnwiki at Microsoft with a link to this article and with clear and detailed reasons why you own the content or have explicit permission from the author.
Content was taken from: "Counting the number of files in a directory, command line style"
Published by aseem1234 on June 17, 2010
thebackroomtech.wordpress.com/.../counting-the-number-of-files-in-a-directory-command-line-style