Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 2 down vote accepted

On Windows platforms:

dir /s *.py
share|improve this answer
add comment

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
add comment
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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