Count the number of files in a directory (Windows)
Was randomly asked to find out the number of files in the project at work and most searches on Google turned up instructions for doing it in Unix/Linux. Figured I should put the Windows version here for future reference. Fire up MS-Command Prompt and... dir "c:\myworkspace" /s /b | find /c ".txt" Returns the count of number of text files in current directory (myworkspace) and all sub-directories. dir "c:\myworkspace" /s /b | find ".txt" > listOfFiles.txt Outputs the list of text files in current directory and all sub-directories to the file listOfFiles.txt How it works: Taken from Computer Hope.com - MS DOS and command prompt dir [path] [attributes] Displays a list of files and subdirectories in the directory specified by [path]. /s Displays files in specified directory and all subdirectories. /b Uses bare format (no heading information or summary). find [attribute] "string" Searches for a text string in a file or files. /c Displays ...