reading a txt file with dos

Associate
Joined
8 Mar 2007
Posts
2,176
Location
between here and there
hello to all,

I want to make a simple batch file to back files from a folder on my laptop to a folder on my PC when I'm using the laptop at home.

I intend to put it in the startup folder to run every time it starts up. I used a simple "if exist" command to check if the Pc folder is available and used a loop to re-try 3 times (allowing time for network connection)

I would like to only back up files that have been changed within the last 2 days.

I started thinking that i could use "date /t >>c:\date.txt" to output it and then bring it back in as a value, then use that value with the Xcopy command with the date switch.

The problem is that the date /t command outputs in the dd/mm/yy format when the Xcopy command is expecting dd-mm-yy

Is there any way to change the format or even read just parts of a txt file line and use the dd, mm and yy on their own. (ie, date /d:%dd%-%mm%-%yy% or something)

any ideas?
 
I've checked Xcpoy /? and can't see a switch that would do that function.

do you know what switch is it??

cheers dude
 
robocopy? that not a standard dos (win xp prompt) command, at least i can't find it.

these no real reason not to use synctool, except the fact I'd rather write it my self, mainly cos I'm sad like that.
 
cheers for the post guys,

I got it working, used robocopy in the end. (damm it's got a load of functions!)

cheers again!
 
Back
Top Bottom