0

I am trying to compress a specific files:

find /media/mount/storage -newermt "2013-08-01 00:00:00" -path '*/*wind.txt' -print0 | xargs -0 gzip -l >> file_system.tar.gz

but I am getting the following error:

gzip: /media/mount/storage/20130811120802_RHI1/20130811121000_wind.txt: not in gzip format

Where do I make the mistake?

EDITED: with the answer written by chronitis sometimes the tar is recreated, this is the output:

 /media/mount/storage/File system/20130505082135_CT1/20130505090000_wind.txt
 /media/mount/storage/File system/20130505085301_CT1/20130505090000_wind.txt
 tar: Removing leading `/' from member names <- the size of the tar became zero
 /media/mount/storageFile system/20130505085301_CT1/20130505091000_wind.txt
 /media/mount/storageFile system/20130505085301_CT1/20130505092000_wind.txt

1 Answer 1

2

I'm assuming that what you want to do is create a gzipped tar archive containing all the files the find command locates (as opposed to separately gzip each of those files).

There are several issues with the above command:

  • gzip -l accepts an existing archive and prints the contents
  • gzip by itself does not produce tar archives (a container for multiple files), but just compresses each file individually

What you probably want is something like:

find [conditions] -print0 | xargs -0 tar -zcf filesystem.tar.gz
1
  • I used tar but the compressed file is recreated after a while, so I check the size the tar file and it is changing, which can mean that it is recreating the file again and again
    – Mokus
    Feb 3, 2014 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .