Using Robocopy with File Sizes and Ages

Written by Barry Dysert (last updated December 11, 2017)

In another tip (Checking the Archive Attribute with Robocopy) we saw that we can have Robocopy perform operations based on file attributes. You can also affect its operation based on file sizes and ages.

For file sizes, you'd use the switches /MAX:n and /MIN:n, where "n" specifies the sizes of the files, in bytes, that are to be excluded from the copy. As an example, specifying /MAX:10000 tells Robocopy to exclude from copying any file that is larger than 10,000 bytes.

You can also alter what is copied based on the files' ages. The following command-line switches are used for this:

  • /MAXAGE:n - Excludes files older than n days (n can also be a date)
  • /MINAGE:n - Excludes files newer than n days (n can also be a date)
  • /MAXLAD:n - Excludes files unused since n date (LAD is an acronym for Last Accessed Date)
  • /MINLAD:n - Excludes files used since n date (LAD is an acronym for Last Accessed Date)

The only trick to using these options is in understanding what the "n" means. Depending upon its value, "n" can either represent days or a date. If "n" is less than 1900 then "n" is assumed to be a number of days, otherwise "n" is a date of this form: YYYYMMDD.

 This tip (13224) applies to Windows 7, 8, and 10.

Author Bio

Barry Dysert

Barry has been a computer professional for over 35 years, working in different positions such as technical team leader, project manager, and software developer. He is currently a software engineer with an emphasis on developing custom applications under Microsoft Windows. When not working with Windows or writing Tips, Barry is an amateur writer. His first non-fiction book is titled "A Chronological Commentary of Revelation." ...

MORE FROM BARRY

How the Registry is Organized

There may come a time when you need to view or even modify the registry. In such a case, it's good to know how the ...

Discover More

Running Older Programs in Windows

You may still need to use programs that worked under older versions of Windows that don't work so well under Windows 7 or ...

Discover More

Pin Items to File Explorer's Quick Access View

You can improve your efficiency at navigating the file system by using the Quick Access view. This tip shows you how to ...

Discover More
More WindowsTips

Adding File Types to the Search Index

You can fine-tune Indexed Searches by adding file types to the search index. This tip tells you how.

Discover More

Finding Large Files

Large files can quickly take up valuable space on your hard drive. In this tip you discover how to easily search for ...

Discover More

Changing User Permissions for a File

All objects on your computer (e.g., files) have permissions that allow or deny various types of access. This tip shows ...

Discover More
Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


Newest Tips