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.

3 Answers 3

2

On Windows platforms:

dir /s *.py
5

On Linux:

find /path/to/GarlicSim -type f -name "*.py" | wc -l
1
  • 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, ...) Sep 29, 2010 at 20:50
1
find $DIR -type f | sed 's/.*\.//' | sort | uniq -c  | sort -rn
1
  • For the unix-unitiated: this command lists the number of files under $DIR for each extension; the output is sorted by decreasing count. Sep 29, 2010 at 20:51

You must log in to answer this question.

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