# bat file to copy files only modified within the last hour



## twesterm (Nov 18, 2011)

Hi all, I wanted to sync my Skyrim saves to dropbox since I play on multiple computers so I made a quick bat file to copy saves from dropbox when I open Skyrim and then copy over to dropbox when I close dropbox.

The bat file I have now works great but it's cluttering up my dropbox with a lot of files I just don't need. I have the space now so it's not a huge worry but I could see how this directory could grow really big really quick.

Is it possible to make a bat file that copies files from my Skyrim save directory to dropbox that are, say, only an hour old?

This is what I have right now--

```
@ECHO off
xcopy "C:\Users\xxxxxx\Dropbox\Games\SkyrimSaves" "C:\Users\xxxxxx\Documents\My Games\Skyrim\Saves" /d /s /r /y
"C:\Program Files (x86)\Steam\steamapps\common\skyrim\TESV.exe"
xcopy "C:\Users\xxxxxx\Documents\My Games\Skyrim\Saves" "C:\Users\xxxxxx\Dropbox\Games\SkyrimSaves" /d /s /r /y
@ECHO on
```


----------



## Squashman (Apr 4, 2003)

Doing time math in batch is not the easiest. I remember a guy who wrote a 3rd party utility to do it at the command line but I have never been able to find the download for it. This was a long time ago.


----------



## centauricw (Jun 26, 2010)

You can do this with robocopy. The relevant options are:


```
/MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
/MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
/MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
/MINLAD:n :: MINimum Last Access Date - exclude files used since n.
             (If n < 1900 then n = n days, else n = YYYYMMDD date).
```


----------



## Squashman (Apr 4, 2003)

Days is not quite the same as an hour.


----------

