Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-24-2004, 02:42 PM   #1
Solid State Member
 
Join Date: Mar 2004
Posts: 19
Default Batch File Help

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 is offline   Reply With Quote
Old 03-24-2004, 02:59 PM   #2
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Re: Batch File Help

Quote:
Originally Posted by RichSpencer
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.
__________________

__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 03-30-2004, 09:11 AM   #3
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default

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:\
------------------------------------------------------------
root is offline   Reply With Quote
Old 03-30-2004, 10:38 AM   #4
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Re: Batch File Help

Thanks for taht root.
__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 04-06-2004, 07:00 PM   #5
Baseband Member
 
Join Date: Feb 2004
Posts: 32
Send a message via AIM to Traveller
Default

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?
Traveller is offline   Reply With Quote
Old 04-06-2004, 08:19 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: Batch File Help

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 is offline   Reply With Quote
Old 04-07-2004, 06:42 AM   #7
Baseband Member
 
Join Date: Apr 2004
Location: USA
Posts: 58
Default Re: Batch File Help

Try PKZIP.
aharvek is offline   Reply With Quote
Old 04-07-2004, 07:35 PM   #8
Baseband Member
 
Join Date: Feb 2004
Posts: 32
Send a message via AIM to Traveller
Default

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.
Traveller is offline   Reply With Quote
Old 04-10-2004, 08:44 PM   #9
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: Batch File Help

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 is offline   Reply With Quote
Old 04-11-2004, 10:52 PM   #10
Baseband Member
 
Join Date: Apr 2004
Location: USA
Posts: 58
Default Re: Batch File Help

Quote:
Originally Posted by root
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.
__________________

aharvek is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:12 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0