bat file to copy files only modified within the last hour

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

twesterm

Thread Starter
Joined
Nov 18, 2011
Messages
1
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--
Code:
@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

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
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.
 
Joined
Jun 26, 2010
Messages
444
You can do this with robocopy. The relevant options are:

Code:
/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).
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top