*Quickly* counting the number of files on a partition

Ian Zimmerman nobrowser-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Jan 19 07:02:37 UTC 2006


Madison>    Can I *quickly* get the number of files (and dirs, links,
Madison> etc) on a given partition or under a certain directory? The two
Madison> keeps are "quickly" and "partition"; it's can't traverse file
Madison> systems /or/ be limited to a directory (and it's sub
Madison> directories).

Depends:

1/ what you mean by "file".  Most Unix filesystems can link multiple
names to a single entity known as inode.

2/ if you need _just_ complete partitions or arbitrary directory trees.

If you're fine with counting just inodes on a complete partition, the
answer is yes: man statfs(2) or man stat(1) (in particular the -f flag).

Otherwise, you need someone smarter than me to answer :)

-- 
A true pessimist won't be discouraged by a little success.
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list