iGuest 3 Report post Posted January 15, 2009 how to use batch file saving a folder.?Batch Fileshow to use batch file saving a folder.? I want to create a batch file, a script I can copy a whole folder and zip it to another folder.. thanx in advance - MheyKeywords: Share this post Link to post Share on other sites
darasen 0 Report post Posted January 18, 2009 There is not a command line that can be used to perform zip functions in Windows. Thus you will need a third party such as Pkzip or 7-zip that allows command line zip functions. Share this post Link to post Share on other sites
yordan 10 Report post Posted January 18, 2009 winrar has command line options. I use it for backing up several directories in a single .rar file.This file can then be uncompressed using the standalone version of 7zip.Here is the batch file I use in order to backup four important folders in a single self-extractible compressed file : mkdir g:\tmp\backupsC:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC d:\usr\DaddyC:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC D:\sources\Daddy\MysqlC:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC D:\TOOLS\standaloneC:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC D:\Useful\MotherRAR.EXE comes with the winrar installation.-sfx says "please create a self-extracting archive"You see that the foldes I backup are on my D: diskand the backup is on my g: diskSo, if I loose the g: disk no problem because my original files are still hereAnd if I loose the D: disk I restore it from the backup on g:And of course, the script finishes with a "net use" mounting a shared folder on another pc, and then "copy g:\tmp\backups\motherPC.* z:"Hope this helpedYordan Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 22, 2009 HelloThis may be a bit late.. but you could try this.Copy and paste the following to myzip.bat @echo offremrem myzip.batremrem A simple file compressor by Nick Rodie.rem Tested in XPpro.remif '%1' == '' goto helpif '%1' == '/?' goto helpif '%2' == '/u' goto uncmpct:cmpctxcopy %1\*.* %1.myzip /e /i /h /ycompact /a /c /s %1.myzip\*.*goto end:uncmpctcompact /a /u /s %1\*.*mkdir %~n1xcopy %1\*.* %~n1 /e /i /h /yrmdir /s /q %1goto end:helpecho.echo Usage : myzip dirname [/u]echo.echo Creates: dirname.myzipecho /u: dirname with ".myzip" removed.echo.echo Options: dirname Name of directory to compact.echo : /u Uncompact.echo.:end Share this post Link to post Share on other sites
yordan 10 Report post Posted March 22, 2009 Really nice, thanks. I even did not guess that the winzip embedded in Microsoft windows offered a command line usable version! Share this post Link to post Share on other sites