Move files older than 365 days

Page 1 of 2 12 LastLast

  1. Posts : 4
    windows 7 64bit
       #1

    Move files older than 365 days


    I have a set of files I would like to archive and thing older than 1 year or 365 days. I have been trying to to use the xcopy or move commands but have not been able to to get this to work. Anyone have any thoughts on how to do this in a batch file? Thanks.
      My Computer


  2. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #2

    Hi,

    Try ROBOCOPY. Type robocopy /? at the command prompt to see the options. You are probably interested in the /MOVE AND /MAXAGE:n switches.

    Example:
    Code:
    robocopy E:\DataFiles Z:\Backup\DataFiles /MOVE /MAXAGE:365
    Moves all files in E:\DataFiles that are older than 365 days into Z:\Backup\DataFiles. robocopy commands can be incorporated into batch files just like copy or xcopy.

    Regards,
    Golden
    Last edited by Golden; 31 Oct 2012 at 09:07. Reason: fix spelling
      My Computer


  3. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #3

    CBHV said:
    I have a set of files I would like to archive and thing older than 1 year or 365 days. I have been trying to to use the xcopy or move commands but have not been able to to get this to work. Anyone have any thoughts on how to do this in a batch file? Thanks.
    With older than 365 days you mean "not modified last 365 days" or "not created last 365 days"? If you mean "not modified last 365 days" ... do what user Golden told you
      My Computer


  4. Posts : 4
    windows 7 64bit
    Thread Starter
       #4

    That did it had did not know about maxage. Thanks for help Golden.

    Golden said:
    Hi,

    Try ROBOCOPY. Type robocopy /? at the command prompt to see the options. You are probably interested in the /MOVE AND /MAXAGE:n switches.

    Example:
    Code:
    robocopy E:\DataFiles Z:\Backup\DataFiles /MOVE /MAXAGE:365
    Moves all files in E:\DataFiles that are older than 365 days into Z:\Backup\DataFiles. robocopy commands can be incorporated into batch files just like copy or xcopy.

    Regards,
    Golden
      My Computer


  5. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #5

      My Computer


  6. Posts : 1
    Windows 7 Home 64-bit
       #6

    I'm going to disagree with using the switch /maxage. If you want to move files older than 365 days, then the switch should be /minage as you want the move to only occur for files older than 365 days. I just tried myself and maxage actually moving files newer than 365 days from today.
      My Computer


  7. Posts : 5,440
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #7

    Did you not realise that this thread is over three years old?
      My Computer


  8. Posts : 4
    CALIFORNIA
       #8

    Is there a rule against replying to old threads? The answer is wrong and seems more useful to correct it than to point out the thread is three years old.
      My Computer


  9. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #9

    Sigh..................have a look at robocopy /? at the command line.

    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.
    Read post #4 to se whether the solution worked for the original poster.
      My Computer


  10. Posts : 4
    CALIFORNIA
       #10

    Either the op miswrote their question or didn't actually try the solution. He just thanked you for your post but doesn't actually confirm your solution is correct.

    If you use maxage switch, it will exclude files that are older than one year. This means only files newer than one year get moved. That's exactly the opposite of what op wants.

    Try the solution yourself and you will see maxage is the wrong switch for what the op is asking for (unless the op wanted something different from what s/he posted).
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:20.
Find Us