Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Help

Status
Not open for further replies.

jtwendel

IS-IT--Management
Jan 12, 2004
1
US
I am in need of a batch program that will copy dated folders from local machines back to the server. The batch file will be run from each user on the server. The following scipt works well except I need to get the previous days folder and not the current. Any suggestions? Also, is there a way to zip the folder once it's copied using a batch command?

@ECHO OFF
ECHO.
ECHO Copying today's folder...
FOR /F "tokens=2-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%H%%F%%G)
MD q:\Archive\%v_date%
ECHO.
ECHO Copying '%v_date%'...
COPY /V /Z "v:\aloha\%v_date%" "q:\Archive\%v_date%"
ECHO.
copy /Y v:\aloha\*.txt q:
ECHO Finished copying.
ECHO.
 
>Also, is there a way to zip the folder once it's copied using a batch command?

you'll need a zipping tool working from command line.
Like, PKZip from PKWare.
 
How about writing a little basic program to calculate yesterday's date and sending it to the batch file.

Or, run the program at the end of the day in which (tomorrow) yesterday's are today's files.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top