1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

bat file to copy files only modified within the last hour

Discussion in 'DOS/Other' started by twesterm, Nov 18, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. twesterm

    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
    
     
  2. Squashman

    Squashman 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.
     
  3. centauricw

    centauricw

    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).
     
  4. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Days is not quite the same as an hour.
     
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 733,556 other people just like you!

Loading...
Similar Threads - file copy files
  1. niedernsill
    Replies:
    3
    Views:
    424
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1027444

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice