Batch FIle PLEASE HELP

arew264

OSNN Junior Addict
Joined
22 Feb 2005
Messages
36
Batch File Problem

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,4...386947,00.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.


 
Re: Batch File Problem

arew264 said:
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,4...386947,00.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.


I came up with this code but could not get it to work:

@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

could someone please help me? I can't get the rename to work.
 
Re: Batch File Problem

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

it works fine but could someone help me get it to separate the date with hyphens instead of slashes?
 
I'm using this line of code to rename a backup file and I have already created a script that moves it to a different folder. THe backup program will make the file and I will run this batch file to rename it to the date and move it.

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

I need to get this code to separate the date with hyphens instead of slashes. can someone please help me?
 
Try this and see if it work the way you want.

for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do ren "C:\backups\XP\new\C_driveoo1.v2i" %%a-%%b-%%c-C_drive001.v2i
 
Thanks for your help. THere is one more thing though. I have a third computer running windows 98 what I'm sending the backups to. I have a batch file on there that I needed this code for also but it wouldn't work. Here's the code:

copy C:\backups\xp\new\ \\ex98\backups\xp\new\
copy C:\backups\98\new\ \\XP\backups\98\new\
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do move C:\backups\98\new\%%b-%%a-%%c-98C_drive.v2i C:\backups\98\old\%%b-%%a-%%c-98C_drive.v2i
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do move C:\backups\XP\new\%%b-%%a-%%c-XPC_drive.v2i C:\backups\XP\old\%%b-%%a-%%c-XPC_drive.v2i

I hope someone can find a way to make this work on windows 98 like it did on XP.
 
I threw togeather this little program. Run it from the cmdline.
Renames all specified file types to their creation date and time, then moves them to another folder.

I don't know if it will work on win9x systems though, let me know and I can revise it.

Example:
timebch.exe <source> <destination> <filetype>
timebch.exe "C:\ghost\files\\" "C:\ghost\backup\" "bak"

Visit the AutoIt forums if you want to follow the progress of this script
 

Attachments

  • timebch.zip
    128 KB · Views: 80

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back