Wednesday, 14 April 2010

find count of files in each directory

using find it is easy to find all files in directories recursively and print the total count of files.But, i want files to be listed in each directory.This can be done in perl one liner.

perl -e '
sub z {
foreach $f(@l){($c++) if -f $f;
push(@x,$f) if -d $f }
print"$p: $c\n" if $c >0;
foreach $f (@x){z($f)}}z(".");'

No comments:

Post a Comment

Tweets by @sriramperumalla