SSH Script to Compress Folder on server

Discussion in 'Apache' started by infonote, Jun 18, 2007.

  1. #1
    Hi,

    Can anyone please give me a url of an SSH script to compress a folder on server.

    Thanks in advance
     
    infonote, Jun 18, 2007 IP
  2. itdevil

    itdevil Well-Known Member

    Messages:
    632
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    110
    #2
     $ zip -r folder.zip folder 
    Code (markup):
    :)
     
    itdevil, Jun 18, 2007 IP
    infonote likes this.
  3. infonote

    infonote Well-Known Member

    Messages:
    4,032
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Thanks for reply. Rep given.

    I thought that ZIP does not exist in Unix. Tar file.
     
    infonote, Jun 18, 2007 IP
  4. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It usually is bundled with newer distros, if not you can download it and or use a package manager.

    
    yum install zip unzip
    
    OR
    
    apt-get install zip
    
    Code (markup):
    I personally use tar/gzip though.

    
    tar -cf blah.tar folder/
    gzip -9 blah.tar
    
    Code (markup):
     
    CodyRo, Jun 19, 2007 IP
  5. andre75

    andre75 Peon

    Messages:
    1,203
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I don't really see the benefit of zip.
    if you run
    tar czvf folder.tgz folder
    you get a compressed (gzip compressed) tar file without having to install anything
     
    andre75, Jun 20, 2007 IP
  6. DaiTengu

    DaiTengu Active Member

    Messages:
    49
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    75
    #6
    I'm partial to bzip2, as it tends to compress better than gzip.

    tar jcvf filename.tbz folder
    Code (markup):
    Note: it does take a bit longer to compress if there's a large amount of data.
     
    DaiTengu, Jun 20, 2007 IP