|
|
![]() |
|
|
Top | #1 |
|
OSNN Junior Addict
Joined: February 2005
Posts: 36
Reputation: 0
Power: 62 |
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: |
|
|
|
|
|
Top | #2 |
|
OSNN Junior Addict
Joined: February 2005
Posts: 36
Reputation: 0
Power: 62 |
Originally Posted by arew264
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. |
|
|
|
|
|
Top | #3 |
|
OSNN Junior Addict
Joined: February 2005
Posts: 36
Reputation: 0
Power: 62 |
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? |
|
|
|
|
|
Top | #4 |
|
OSNN Junior Addict
Joined: February 2005
Posts: 36
Reputation: 0
Power: 62 |
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? |
|
|
|
|
|
Top | #5 |
|
Are we there yet?
Joined: May 2002
Location: In a house
Posts: 177
Reputation: 40
Power: 97 |
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 |
|
|
|
|
|
Top | #6 |
|
OSNN Junior Addict
Joined: February 2005
Posts: 36
Reputation: 0
Power: 62 |
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. |
|
|
|
|
|
Top | #7 |
|
OSNN Senior Addict
Joined: February 2003
Posts: 955
Reputation: 300
Power: 99 |
I threw togeather this little program. Run it from the cmdline.
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vbscript or batch file to play audio file for user on startup | Punkrulz | Web Design & Coding | 10 | November 29th, 2006 1:48pm |
| BATCH file help | dillinja | Web Design & Coding | 0 | March 24th, 2006 9:43am |
| Batch File Q | omg its nlm | Web Design & Coding | 4 | March 10th, 2004 1:24am |
| Batch File Help | the_tazinator | Windows Desktop Systems | 4 | November 21st, 2003 12:12am |
| XP Batch file | RogerPhillis | Windows Desktop Systems | 4 | November 24th, 2002 11:18pm |
![]() |