Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Posts
    76

    via ssh i would like to zip an entire directory, but how?

    I'm very new to linux and can't seem to find out how to do this. I'd like to know the command line to copy one of my directory folders and zip it. For example this directory has 3 gigs of files in it, so instead of ftp'ing this entire thing down file by file i'd like to ssh to my filesystem, enter a command that generates a zip of the directory (but leaves the current directory alone). Thanks for any help!

  2. #2
    Join Date
    Dec 2004
    Location
    New York, NY
    Posts
    10,710
    cd /path/to/folder
    zip whatever.zip *
    MediaLayer, LLC - www.medialayer.com Learn how we can make your website load faster, translating to better conversion rates for your business!
    The pioneers of optimized web hosting, featuring LiteSpeed Web Server & SSD Storage - Celebrating 10 Years in Business

  3. #3
    Join Date
    Nov 2003
    Posts
    477
    Quote Originally Posted by layer0
    cd /path/to/folder
    zip whatever.zip *
    That is why I like Unix shell,
    everything is simple but powerful

  4. #4
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,103
    if your folder has subfolders you will need -r flag
    zip -r filename.zip foldername/

  5. #5
    Join Date
    Aug 2006
    Posts
    76
    Quote Originally Posted by sasha
    if your folder has subfolders you will need -r flag
    zip -r filename.zip foldername/
    Thanks for the info, but i am worried how long this could take. I did this for a test folder and it gave the entire output while it zipped. The folder i want to zip has 10,000's of files so my terminal might be scrolling output like this for hours. Is there a way to do the above without it showing the entire output in progress? Here is the terminal output from my test:

    ~/desktop User$ zip -r scans.zip scans/
    adding: scans/ (stored 0%)
    adding: scans/.DS_Store (deflated 94%)
    adding: scans/alley2.jpg (deflated 19%)
    adding: scans/amelia.jpg (deflated 24%)
    adding: scans/amelia_swanlake.jpg (deflated 20%)
    adding: scans/amelia_swanlake2.jpg (deflated 17%)
    adding: scans/keepclear.jpg (deflated 16%)
    adding: scans/Scan 1.jpg (deflated 22%)
    adding: scans/Scan 1.tiff (deflated 38%)
    adding: scans/Scan 2.jpg (deflated 19%)
    adding: scans/Scan 2.tiff (deflated 32%)
    adding: scans/Scan 3.tiff (deflated 27%)
    adding: scans/Scan 4.tiff (deflated 17%)
    adding: scans/Scan.tiff (deflated 35%)
    adding: scans/untitled folder/ (stored 0%)
    adding: scans/untitled folder/.DS_Store (deflated 96%)
    adding: scans/untitled folder/untitled folder/ (stored 0%)
    adding: scans/Untitled-1.psd (deflated 43%)
    adding: scans/window.jpg (deflated 16%)

    I'd rather it just accept a command and then give me back my terminal cursor when it's complete..

  6. #6
    zip -h and look for the option to do it silently.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •