Batch File to Rename backups

Score
0
Vote Up
February 22, 2005 at 16:17:11 Pacific
Specs: Windows XP Pro, 2.8GHz/512MB

I have Norton GHost to do backups between three computers, and I need help making a batch file that renames the backup files that Ghost creates to the time and date they were created. I could replace this with a batch that simply names them to today's date as I will be running this file as a scheduled task the day the backup is created. The batch file I'm looking for should:

rename the files to match the date they were made
copy them to \\wielinator\backups\XP
move them to C:\backups\XP\old

The files I want this done to are in C:\backups\XP\New
THis is all part of a large scheduling, organizing, and copying plan that keeps three computers backed up and lets them do the backups when I don't have to worry about someone getting ticked off because their stuff got lost when they were working on it. I have the copy command with all the echo labeling I need:

ECHO OFF
ECHO This batch file copies the C drive backup files to the WIelinator
ECHO READY TO BACKUP
ECHO backing up...
COPY "C:\BACKUPS\XP\NEW" "\\WIELINATOR\BACKUPS\XP"
ECHO All done!

I think I can do the move part of the file, but I can't get the renaming to work. I also tried the suggestion at http://www.pcmag.com/article2/0%2C4...386947%2C00.asp but it would not work. I'm sure theres someone here who really knows how to make a batch file that can help me.


Reply ↓  Report •


#1
Vote Down
Score
0
Vote Up
February 23, 2005 at 03:56:27 Pacific

I came up with this code:

@ECHO OFF
FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET mydate=%%J-%%K-%%L
ECHO The value is "%mydate%"
ren C:\backups\XP\New\C_drive001.v2i %mydate%.v2i
copy C:\backups\XP\New\%mydate%_Cdrive.v2i \\wielinator\backups\XP\Old\%mydate%_Cdrive.v2i
move C:\backups\XP\New\%mydate%_Cdrive.v2i C:\backups\xp\old\%mydate%_Cdrive.v2i

but I can't get it to work. can someone please help me?


Reply ↓  Report •

#2
Vote Down
Score
0
Vote Up
February 23, 2005 at 04:18:06 Pacific

I just found this code:

For /F "tokens=2-4 delims=. " %%A in ('Date /T') Do Rename C:\backups\XP\new\C_driveoo1.v2i %%A%%B%%C_drive001.v2i

but I need some help getting it to output the date with hyphens instead of slashes.


Reply ↓  Report •

Reply to Message Icon Start New Discussion
Related Posts

« XP update available. sounds when ads change »

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.

Ask the Community!
Describe your Problem
Example: Hard Drive Not Detected on My PC