dcm99 Posted January 9, 2013 Posted January 9, 2013 Can anyone point me in the right direction to do the following I have a series of users folders that I need to zip to individual zip files. ie: Input folders A B C Output: A.zip B.zip C.zip All the input folders will have subdirectories and files. There will be several hundred folders so I must automate it. I don't expect anyone to write a solution, but any pointers will be appreciated! Many thanks, David
Steve21 Posted January 9, 2013 Posted January 9, 2013 If you install 7zip commandline version it will work command line easy enough. Examples: 7-Zip Command-Line Examples Steve
CyberNerd Posted January 9, 2013 Posted January 9, 2013 A script isn't needed for something this simple - you can do it all on the command line in a single line find . -type d -maxdepth 1 -exec zip -r {} /path/you/want/the/files/to/go/in \;
mattx Posted January 9, 2013 Posted January 9, 2013 (edited) 7 Zip is the way to go - have fun....... I've quite a few scripts using the command line on that - it hurts [ especially as some of mine have folders to exclude ] but once done it's rather good. Note - if you are going to automate or have something running as a schedule then I suggest piping it all to a file so you have a log. Example: "c:\program files\7-zip\"7z.exe a d:\matt\LON.7z d:\Matt\files -mx9 -ssw -xr!pdf_out -xr!csv_out -xr!man_rpts -xr!cust_rpt -y>d:\matt\log.txt" Will zip everything in the files folder but will exclude the folder names after the -xr! switch. It pipes it all to a text file for me to go over. Edited January 9, 2013 by mattx
Arthur Posted January 10, 2013 Posted January 10, 2013 These batch files may help. The second one includes the parent folder in the zip file, while the first doesn't. @echo off :: Location of 7za.exe SET EXE="C:\Program Files (x86)\7-Zip\7za.exe" for /D %%a in (*) do ( cd "%%a" %EXE% a -t7z -m0=lzma2 -r -y -xr!*.tmp -xr!.ds_store -xr!thumbs.db -xr!~$*.* -xr!desktop.ini "..\%%a.7z" * cd .. ) @echo off :: Location of 7za.exe SET EXE="C:\Program Files (x86)\7-Zip\7za.exe" for /D %%a in (*) do ( cd "%%a" %EXE% a -t7z -m0=lzma2 -r -y -xr!*.tmp -xr!.ds_store -xr!thumbs.db -xr!~$*.* -xr!desktop.ini "..\%%a.7z" "..\%%a\" cd .. )
CyberNerd Posted January 10, 2013 Posted January 10, 2013 These batch files may help. The second one includes the parent folder in the zip file, while the first doesn't. Ouch. I prefer my one liner !
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now