For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2006 > Re: checking gzip files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: checking gzip files
Xavier Noria

2006-01-10, 4:02 am

On Dec 30, 2005, at 13:14, S Khadar wrote:

> Hi all,
>
> I have a 15 thousand directories - each of them contain say 10
> files (all
> *.gzip)
> out of this 10 *.gz files - I want to check whether a file named
> foo.gz
> contain any content or not - since my files are gzipped even the
> blank file
> occupies some size.


Even if gzipped files have always more than 0 bytes, wouldn't it be
true than all empty gzipped files have the same size, and that non-
empty gzipped files are greater than that minimum? In this Mac that
size seems to be 24 bytes.

If that was the case you could use a regular -s instead of that z*
trickery, which multiplied by thousands of directories will make a
difference.

-- fxn

% touch foo
% ls -l foo
-rw-r--r-- 1 fxn staff 0 Dec 30 20:26 foo
% gzip foo
% ls -l foo.gz
-rw-r--r-- 1 fxn staff 24 Dec 30 20:26 foo.gz
% echo x > bar
% ls -l bar
-rw-r--r-- 1 fxn staff 2 Dec 30 20:27 bar
% gzip bar
% ls -l bar.gz
-rw-r--r-- 1 fxn staff 26 Dec 30 20:27 bar.gz

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com