none
Moving files based on modified date

    Question

  • We need a script to move files on a file server that have a modified date older than, say 4 years. We were using a Robocopy command that worked like a charm to move the files but it can't key in on modified dates. Has anyone come up with something like this?


    Orange County District Attorney

    Thursday, April 05, 2012 3:17 PM

Answers

All replies

  • Hi,

    It looks like robocopy's /maxage and /minage options use the last modification date. See the robocopy documentation for details. You can also run a test to verify this.

    Bill

    Thursday, April 05, 2012 3:32 PM
    Moderator
  • Hello,

    From what I've been able to find, /minage and /maxage use the file timestamp date instead of the modified date.


    Orange County District Attorney

    Thursday, April 05, 2012 4:22 PM
  • Hi,

    (?) What's the difference between "file timestamp date" and "modified date"?

    Bill

    Thursday, April 05, 2012 4:33 PM
    Moderator
  • You know, after some further testing, it appears that you are correct. The /maxage and /minage do in fact reflect the modified date! That will work for us!

    Orange County District Attorney

    Thursday, April 05, 2012 4:34 PM
  • What I was thinking of was the original file creation date or file timestamp date. After thinking about this a bit more, there's really no 'original' date, each time a file is modified it's date changes. I guess I was inventing a new file attribute. Duh.


    Orange County District Attorney

    Thursday, April 05, 2012 4:36 PM
  • What I was thinking of was the original file creation date or file timestamp date. After thinking about this a bit more, there's really no 'original' date, each time a file is modified it's date changes. I guess I was inventing a new file attribute. Duh.


    Orange County District Attorney

    There are three dates on every file:

    Created
    Modified
    Accessed

    As noted earlier, the Accessed timestamp is not populated on newer OS for perfomance reaons. It can be turned on with a registry setting.

    In RoboCopy MinAge/MaxAge reflect the 'Modified' timestamp and MinLAD /MaxLAD reflecr Accesses:

              /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.

    All of these timestamps are stored as FileTime values which are LargeInteger values.


    ¯\_(ツ)_/¯

    Thursday, April 05, 2012 6:20 PM
  • FYI - for scripters

    ## VBscript/WSH FileSystemObject files
    DateCreated
    DateLastAccesed
    DateLastModified

    ## PowerShell/Net FileInfo
    CreationTime
    LastAccessTime
    LastWriteTime


    ¯\_(ツ)_/¯

    Thursday, April 05, 2012 6:34 PM