Page 1 of 1

Overwrite if older

Posted: 01 Sep 2009 03:32
by egrimisu
Hi guys, i'm brand new on the forum and obviosly i have some question in witch i hope to get answers.

c:\Live\document.txt
c:\Backup\

So, i want to make a logoff script that cals this bat file that i want to do the next thing: i want to copy document.txt from c:\live into c:\backup\ and overwrite the c:\backup\document.txt only if c:\livedocument\document.txt is older with atleat 7 days than docment.txt from backup folder. Thanks in advance

if c:\live\document.txt older than c:\backup\document.txt with atleast 7 days
copy if c:\live\document.txt c:\backup\document.txt

Posted: 01 Sep 2009 15:25
by avery_larry
Can be done with custom batch script -- but xcopy will already do it (not that I like xcopy), or, much better, use robocopy. Free from Microsoft in the resource kit. Great tool and it'll do exactly what you want (I'll bet).

http://ss64.com/nt/robocopy.html

http://www.microsoft.com/downloads/deta ... 8c4790cffd