Computing.Net > Forums > Windows XP > files with date stamp

files with date stamp

Reply to Message Icon

Original Message
Name: William Lockie (by blockie)
Date: May 22, 2008 at 19:58:04 Pacific
Subject: files with date stamp
OS: WXP SP2
CPU/Ram: 3.0/2G
Model/Manufacturer: Clone
Comment:

I am anxious to learn how to date stamp backup files. Presently the backup program I am using backs up to a file using the same name, thereby overwriting yesterdays file . I wind up with only the last backup made.

I would like to append the date, in mm/dd/yy format, to the file name created. This way each backup would have a unique name and I could have more than one backup.

I am, otherwise, satisfied with this backup program so please do not recommend another program as your answer. Just show me how to do this.

Thanks,
Bill

Existing filename........TEST.TXT
New filename.............TEST_05/22/08.TXT

William Lockie
"OS: WXP SP2
CPU/Ram: 3.0/2GB
Manufacturer/Model: clone"


Report Offensive Message For Removal

Response Number 1
Name: aegis
Date: May 22, 2008 at 20:40:41 Pacific
Subject: files with date stamp
Reply: (edit)

Instead of renaming the file, can you have the backup program save all the days backups to a new 'dated' folder for each day?

You are very wise to have multiple backups.


Report Offensive Follow Up For Removal

Response Number 2
Name: jefro
Date: May 22, 2008 at 20:41:48 Pacific
Subject: files with date stamp
Reply: (edit)

Is the program name a secret? Might it help us to know it's name?

I would suggest ntbackup but I don't know if you are using that.

"Best Practices", Event viewer, host file, perfmon, are in my top 10


Report Offensive Follow Up For Removal

Response Number 3
Name: William Lockie (by blockie)
Date: May 22, 2008 at 21:52:21 Pacific
Subject: files with date stamp
Reply: (edit)

The program name is not a secret. It is DriveImage XML from Runtime Software.
I have customized it so that I can run it from a batch file and then I put it in the Windows scheduler.
Here's the script in the batch file;

"C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bc /tD:\Images\Drive_C /r- /s- /c /v
Hope this helps.
Bill
PS: Drive_c in the above script is the filename generated during backup.

William Lockie
"OS: WXP SP2
CPU/Ram: 3.0/2GB
Manufacturer/Model: clone"


Report Offensive Follow Up For Removal

Response Number 4
Name: Razor2.3
Date: May 22, 2008 at 22:03:35 Pacific
Subject: files with date stamp
Reply: (edit)

New filename.............TEST_05/22/08.TXT
Forward slashes are not allowed in filenames.


Report Offensive Follow Up For Removal

Response Number 5
Name: William Lockie (by blockie)
Date: May 23, 2008 at 07:46:05 Pacific
Subject: files with date stamp
Reply: (edit)

Ok Razor2.3.
Lets do it with Test_052208,text. I really don't care as long as I can see the difference from day to day and not overwrite the old file.
Bill

William Lockie
"OS: WXP SP2
CPU/Ram: 3.0/2GB
Manufacturer/Model: clone"


Report Offensive Follow Up For Removal


Response Number 6
Name: jsruzicka
Date: May 23, 2008 at 20:36:27 Pacific
Subject: files with date stamp
Reply: (edit)

You'll need a multiline batch file. This should do the trick. I found the code for everything but the last line from someone named seamonkey420.

The last line will change to a directory called d:\imagesMMDDYYYY (for example d:\images05282008).

If your backup software doesn't create directories automatically you'll need to add the line "mkdir d:\images%date%" before the command that actually runs the backup software.

echo on
@REM Seamonkey's quick date batch (MMDDYYYY format)
@REM Setups %date variable
@REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%mm%%dd%%yyyy%

echo D:\Images%date%\Drive_C



Report Offensive Follow Up For Removal

Response Number 7
Name: jsruzicka
Date: May 23, 2008 at 20:38:06 Pacific
Subject: files with date stamp
Reply: (edit)

Oops, sorry, the last line should be:

C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bc /tD:\Images%date%\Drive_C /r- /s- /c /v

I was using the echo command to test the batch file


Report Offensive Follow Up For Removal

Response Number 8
Name: Mechanix2Go
Date: May 24, 2008 at 04:54:11 Pacific
Subject: files with date stamp
Reply: (edit)

To avoid the can of worms involved with date layouts...

This will sequentially number them.

::== seqNtest.bat

:: seq num backups

@echo off
setLocal EnableDelayedExpansion

if not exist test.txt echo nothing to do && goto :eof

for /f "tokens=* delims= " %%a in ('dir/b/a-d/od test_*.txt') do (
set str=%%~Na
set /a N=!str:~5!
)

set /a N+=1
ren test.txt test_!N!.txt


::== done

Hi Razor2.3,

yep no slashes, no stars and bars, no redirects etc


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 9
Name: William Lockie (by blockie)
Date: May 24, 2008 at 08:57:49 Pacific
Subject: files with date stamp
Reply: (edit)

FOR Mechanix2Go
Here it is the modified, for me, the batch file you provided. It does NOT work. At least it does not work after I modified it.
It did work in its original form when I created a test.txt in the same folder as the batch file.
My backup files are on another drive as you can see by the changes I made,
I do not know what the parameters mean after
"dir/b/". This may be the problem. I will continue to work on it,but I hope you are able to detect the error and show me the TRUE way.
Bill

@echo off
setLocal EnableDelayedExpansion
if not exist D:\DriveImage\drive_c.dat echo nothing to do && goto :eof
for /f "tokens=* delims= " %%a in ('dir/b/a-d/od D:\DriveImage\drive_*.dat') do (
set str=%%~Na
set /a N=!str:~5!
)
set /a N+=1
ren D:\DriveImage\drive_c.dat D:\DriveImage\drive-c_!N!.dat
ren D:\DriveImage\drive_c.xml D:\DriveImage\drive_c_!N!.xml

William Lockie
"OS: WXP SP2
CPU/Ram: 3.0/2GB
Manufacturer/Model: clone"


Report Offensive Follow Up For Removal

Response Number 10
Name: Mechanix2Go
Date: May 25, 2008 at 02:48:46 Pacific
Subject: files with date stamp
Reply: (edit)

It's not obvious what's going wrong. You can eliminate some clutter and make the troubleshooting easier by changing to the directory where the files are.

::==
@echo off
setLocal EnableDelayedExpansion

pushd D:\DriveImage

if not exist... blah blah


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: files with date stamp

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software