I want to find how many .py files I have in my GarlicSim directory and all its sub-directories. How do I do that? Either Windows or Linux is fine.

link|improve this question

72% accept rate
feedback

3 Answers

up vote 2 down vote accepted

On Windows platforms:

dir /s *.py
link|improve this answer
feedback

On Linux:

find /path/to/GarlicSim -type f -name "*.py" | wc -l
link|improve this answer
This command works on any unix/POSIX system, not just Linux. It even works on Windows provided you have any unix/POSIX compatibility package installed (Services For Unix, Cygwin, msys, GNUwin32, UWIN, ...) – Gilles Sep 29 '10 at 20:50
feedback
find $DIR -type f | sed 's/.*\.//' | sort | uniq -c  | sort -rn
link|improve this answer
For the unix-unitiated: this command lists the number of files under $DIR for each extension; the output is sorted by decreasing count. – Gilles Sep 29 '10 at 20:51
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.