detecting the size of a tarball

Erik Steffl steffl at
Tue Nov 4 15:31:04 PST 2003

David Bear wrote:
> I have a 100 mg zip drive that I'm writing to as a raw device -- no
> file system -- just 'tar cvf /dev/afd0 stuff'.  I am curious if there
> is a way to find out how big the tarball is on this kind of thing.
> I'm guessing maybe some kind of seek to EOF but not sure how it might
> be accomplished.  any idea's?

   this might work (probably reads whole file): cat < /dev/afd0 | wc -c

   or perhaps this one: du /dev/afd0

   you can try this:

perl -e '$filename = "/dev/afd0"; print "siz eof [$filename] is [" . 
(stat($filename))[7] . "]\n";'

   not sure if that would be any different than ls -l though...


More information about the freebsd-questions mailing list