GeorgeC
01-12-2002, 09:19 AM
Does anyone what command(s) to type to zip up all the contents of a directory? I wish to do this to backup the containing files, which are too many to download one by one.
Thanks,
Thanks,
![]() | View Full Version : Linux command to zip up all files within a directory? GeorgeC 01-12-2002, 09:19 AM Does anyone what command(s) to type to zip up all the contents of a directory? I wish to do this to backup the containing files, which are too many to download one by one. Thanks, RutRow 01-12-2002, 09:35 AM This will give you a full listing of what you want. man zip Quick answer from man page: zip -r foo foo All files and directories in foo will be stored in foo.zip hypernatic.net 01-12-2002, 10:23 AM I would suggest using z tar with GZip compression tar -cvzf ./filename.tar.gz ./directoryname uncompress: tar -xvzf ./filename.tar.gz mkaufman 01-12-2002, 10:40 AM Originally posted by RutRow This will give you a full listing of what you want. man zip Quick answer from man page: zip -r foo foo All files and directories in foo will be stored in foo.zip A lot of Linux distros don't have the zip and unzip programs installed by default though...so I'd also recommend gunzip :) bobcares 01-12-2002, 11:36 AM Hi! zip -r -9 filename.zip /directory. The -9 allows maximum compression. To unzip use unzip filename.zip Have a great day :) regards amar Abu Mami 01-12-2002, 12:54 PM For an example of how to do this, you can take a look at a small script I wrote: Hindsite (http://web.abumami.com/scripts/hindsite.html) In the script, I use tar to zip 'em all together... tar czv -C <source_basepath> -f <destination_file> <source_subdirectory> 1. -C <source_basepath> first changes the directory (for example, a directory holding all your web sites) 2. -f <destination_file> is the file name which will be created in the same directory as the tar command is being run in 3. <source_subdirectory> is the subdirectory under the directory specified in <source_basepath> which will be archived and zipped I hope this help. I also hope the above is correct. In any case, the script works. |