Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

On Windows platforms:

dir /s *.py
share|improve this answer

On Linux:

find /path/to/GarlicSim -type f -name "*.py" | wc -l
share|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
find $DIR -type f | sed 's/.*\.//' | sort | uniq -c  | sort -rn
share|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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .