Counting files of a particualr type

I am pretty sure there is an easier way to do this but this is how I done it the first time.

find ./ -name "*.ogg" -print | perl -wne '$i++; END{print "$i\n"}'

I then thought about it a bit and came up with

find ./ -name "*.ogg" -print | xargs ls | wc -l

now that is much neater ;) but wait, we don't need the "xargs ls"

find ./ -name "*.ogg" -print | wc -l

I then thought about doing it this way

ls -R | grep ".ogg" | wc -l

I'm going to leave it there ;)

Add to delicious Digg This Add to My Yahoo! Add to Google Add to StumbleUpon
| | Comments (0) | TrackBacks (0)

0 TrackBacks

Listed below are links to blogs that reference this entry: Counting files of a particualr type.

TrackBack URL for this entry: http://www.hjackson.org/mt/mt-tb.fcgi/153

Leave a comment

About this Entry

This page contains a single entry by Harry published on December 26, 2004 10:30 PM.

iRiver Playlist Error was the previous entry in this blog.

rsync and vfat filesystems is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01