Jump to content
xisto Community
iGuest

how to use batch file saving a folder.? Batch Files

Recommended Posts

how to use batch file saving a folder.?Batch Files

how 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

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\Mother
RAR.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: disk
and the backup is on my g: disk
So, if I loose the g: disk no problem because my original files are still here
And 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 helped
Yordan

Share this post


Link to post
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.