1

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.

2

On Windows platforms:

dir /s *.py
5

On Linux:

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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