Script to copy files last modified yesterday or earlier?

Caporegime
Joined
8 Mar 2007
Posts
37,146
Location
Surrey
Hey guys

Being a bit lazy, but also finding it quite hard to Google this as people always have different requirements.

Anywhoo, this is what I am trying to acheive:

I have a HTPC running W7 Media Centre with a freeview turner. TV is recorded onto the hard drive in that PC. I also have a Server running WHS. What I want to do is every time the HTPC wakes up to back itself up (or pretty much every time it wakes up) for it to copy any recorded TV programs onto my server. However, I need to make sure it doesn't try to copy any recordings that are currently being recorded.

Therefore I was thinking of writing a little batch file that would copy from the D:\Recorded TV directory on the HTPC to the \\server\Recorded TV directory any files that were modified up to and including yesterday. Working on the assumption that the PC doesn't wake up at exactly 00:00 and try to copy a recording in use, there should always be a few hours buffer of inactivity on files to prove they aren't active recordings.

Anyone know how to do this with either inbuilt Windows functions or something like xcopy?

I don't want to record directly to the Server as if there are any issues with the network or the server it will still record to the local HTPC. The HTPC spends most of its time in hibernate, waking up to record TV or babckup somewhen between 3am and 7am, so there is no guaranteed time it will be on on a daily basis.

Cheers
 
Robocopy works great. Now I just need to figure out how to stop the PC automatically hibernating while its running? Any ideas?
 
Having issue getting the powercfg command to run. Gave up last night as it was late. If you right click on the .bat file and run as Admin, it works. If you run it as a scheduled task it doesn't (yet it runs the robocopy part of the script).
 
Well this is random as hell...

I have set the script to run with highest privileges, and it turns hibernation on and off...

Only thing is, my PC now goes to sleep after 15 minutes, yet its never set to sleep in any of the power configs (only to hibernate).

:confused:
 
Back
Top Bottom