Batch File Help

RichSpencer

Solid State Member
Messages
19
Hi guys, I am a network administrator for a small firm in Canada. I have no experience with batch files. Can anyone write me a batch file that zips files from one drive and copy's them to another. I had one a time before i know it was only two lines of code. Thanks in advance

Richard
 
RichSpencer said:
Hi guys, I am a network administrator for a small firm in Canada. I have no experience with batch files. Can anyone write me a batch file that zips files from one drive and copy's them to another. I had one a time before i know it was only two lines of code. Thanks in advance

Richard
Two lines! that sounds good. Unfortunately I am not that familiar with batch files so I would say something like use a perl script to copy them to the network drive. I'm sure someone else will be able to help you though.
 
This will work for copying one file, at a time, it uses the cazip.exe (which is a command line zip utility) that you can grab for free from the computer associates site...

If anyone knows of a command line zip program that can zip an entire directory rather than just one file then you can use the second code chunk, obviously replacing the name of the zip program.

----------------------------------------------------------
@echo off
echo Making temp directory
md c:\atemp
echo copying files to tempdirectory
xcopy a:\[insert filename] c:\atemp\
echo zipping files
e:\cazip -c c:\atemp\[inster filename] c:\[insert filename].zip
echo put new floppy in...
pause
rxcopy c:\atemp.zip a:\
------------------------------------------------------------

@echo off
echo Making temp directory
md c:\atemp
echo copying files to tempdirectory
xcopy a:\*.* c:\atemp\
echo zipping files
e:\cazip -c c:\atemp\*.* c:\atemp.zip
echo put new floppy in...
pause
xcopy c:\atemp.zip a:\
------------------------------------------------------------
 
Could you be a little more specific as to your task please. Are the files of all one type or all in one location. Do you perform this routine on a set timeline? Do you copy the files to the same location or does it vary?
Which OS do you run?
 
practically all of those things don't matter.
if he performs it on a routine he can schedule the task
if the files are in different locations it doesn't matter Xcopy can copy subfolders and whatever
if the location varies then he'll have to change the bath file.
I assumed a windows OS because he asked for a batch file, not a script. and batch file work on any windows os
 
root,

if he performs it on a routine he can schedule the task
-thats why I asked the question

if the files are in different locations it doesn't matter Xcopy can copy subfolders and whatever
-you are right, however if they are specific files in varied directories not in the same directory branch then that affects how you write the function call.

if the location varies then he'll have to change the bath file.
-again, thats why I asked the question. you can set up batch files to take input.

I assumed a windows OS because he asked for a batch file, not a script. and batch file work on any windows os
-aah, assumptions. Now we all know where that gets you. Additionally I was looking through my programs to see if I had any windows based utilities for the job and some of them are version specific--that whole scripting lib that changes with the varied versions of windows.

Basically what I am saying is their is no need to post if all you are attempting to do is try to make somebody look stupid. Especially considering that post did not provide any value.
 
my point was that anyone with any version of windows would be able to take that simple batch file, and only have to make a few modifications...

As for not posting replies without point...

There are only a couple of posts in this particular thread that have absolutly no relevance...

This is one of them, and the post directly abpve this is another
 
root said:
if the location varies then he'll have to change the bath file.

You could use variables in the script...

For example...

erase.bat
----------
format %1 /q /u
----------

and you would run erase.bat like...

erase.bat c:

would send: format c: /q /u

Just an idea.
 
Back
Top Bottom