Nov 22, 2009

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

free web hosting
Open Discussion & Free Web Hosting > Astahost > Asta ANSWERS!

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

(G)mhey
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

- Mhey
Keywords:

Comment/Reply (w/o sign-up)

Darasen
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.

Comment/Reply (w/o sign-up)

yordan
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 :
CODE
mkdir g:\tmp\backups
C:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC d:\usr\Daddy
C:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC D:\sources\Daddy\Mysql
C:\PROGRA~1\WINRAR\RAR.EXE a -sfx -m5 g:\tmp\backups\motherPC D:\TOOLS\standalone
C:\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

 

 

 


Comment/Reply (w/o sign-up)

nickrodie
Hello

This may be a bit late.. but you could try this.

Copy and paste the following to myzip.bat

CODE
@echo off



rem

rem myzip.bat

rem

rem A simple file compressor by Nick Rodie.

rem Tested in XPpro.

rem



if '%1' == '' goto help

if '%1' == '/?' goto help

if '%2' == '/u' goto uncmpct



:cmpct



xcopy %1\*.* %1.myzip /e /i /h /y

compact /a /c /s %1.myzip\*.*

goto end



:uncmpct



compact /a /u /s %1\*.*

mkdir %~n1

xcopy %1\*.* %~n1 /e /i /h /y

rmdir /s /q %1



goto end



:help

echo.

echo Usage : myzip dirname [/u]

echo.

echo Creates: dirname.myzip

echo /u: dirname with ".myzip" removed.

echo.

echo Options: dirname Name of directory to compact.

echo : /u Uncompact.

echo.



:end

Comment/Reply (w/o sign-up)

yordan
Really nice, thanks. I even did not guess that the winzip embedded in Microsoft windows offered a command line usable version!

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Batch File Saving Folder Batch Files


    Looking for how, to, use, batch, file, saving, a, folder.?

See Also,

*SIMILAR VIDEOS*
Searching Video's for how, to, use, batch, file, saving, a, folder.?
advertisement



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

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com