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

Moving Your Page File

It's quite possible to move your system's page file to a different disk. This tip provides the steps you should follow to ...

Discover More

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

Adding Apps using Microsoft Store

Finding apps to help you with your work or relaxation has never been easier thanks to the Microsoft Store. Quickly look ...

Discover More
More WindowsTips

Rebuilding the Search Index

There may be times when you want to reset the search index and rebuild it from scratch. This tip tells you how.

Discover More

Changing the Default Program for a File

Files are opened by programs depending upon the file's type. If you want to change this association so that a different ...

Discover More

Using the DiskPart Utility

The DiskPart utility is a low-level command-line program that lets you manage disks, virtual disks, partitions, and ...

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 one less than 9?

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


Newest Tips