Web Hosting Talk







View Full Version : via ssh i would like to zip an entire directory, but how?


BillyT
09-03-2006, 06:09 PM
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!

layer0
09-03-2006, 06:47 PM
cd /path/to/folder
zip whatever.zip *

samdax
09-04-2006, 07:56 AM
cd /path/to/folder
zip whatever.zip *
That is why I like Unix shell,
everything is simple but powerful
:D

sasha
09-04-2006, 09:13 AM
if your folder has subfolders you will need -r flag
zip -r filename.zip foldername/

BillyT
09-04-2006, 07:42 PM
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..

page-zone
09-04-2006, 08:14 PM
zip -h and look for the option to do it silently.