gzip several files

Discussion in 'Programming/Scripts' started by rumak18, Jun 9, 2010.

  1. rumak18

    rumak18 New Member

    Hello,
    it seems that this is more tricky, than thought... (-:
    I want to "gzip" several files , but the only result i get by searching in google is , that i have to use gzip with tar together (tar -czf ...) .
    Is there really no possiblity , to compress several files in ONE paket.gz file?
     
  2. Mark_NL

    Mark_NL Member

    Well, it's very common to use tar to create an ARCHIVE of your files, and then compress that archive .. hence why you see all those tar.gz /.tgz files. gzip is more or less made to compress 1 file.
     
  3. BorderAmigos

    BorderAmigos New Member

    The below is part of a backup script I use. It's creates a file called var_www_backup_ with the current date on the end. It excludes files and directories that have the "--exclude=" option and includes the rest. This example is doing directories but just put a file name instead if you like.
    Code:
    tar czPpfh /media/backup/daily_backups/var_www_backup_$(date +%Y%b%d).tgz \
    	--exclude='/var/www/clients/' \
    	/var/www/drush/ \
    	/var/www/media/ \
    	/var/www/scripts/ \
    	/var/www/munin/ \
    	/var/www/scorebrds/ \
    	/var/www/tokens/ \
    	/var/www/lizer/ \
    	/var/www/ftp/ 
    
    (These are not my actual directories :rolleyes: ).
     
  4. jabbertooth

    jabbertooth New Member

  5. rumak18

    rumak18 New Member

    Ok. Thanks guys.
     

Share This Page