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

Determining If a Drive Should be Defragmented

Disk fragmentation is one of those things which, if severe, can adversely affect your system's performance. This tip ...

Discover More

Deleting a Library

Deleting a library can be done with a couple of mouse clicks. And even though you delete the library, the folders and ...

Discover More

Disabling System Restore

Restore points are good to have in case a problem occurs while trying to make changes to your system. If for some reason ...

Discover More
More WindowsTips

Using Robocopy to Copy Entire Directories

It's simple to use Robocopy to copy entire directories. Dealing with directories is what it does best! This tip shows you ...

Discover More

Creating and Using Compressed Folders

If you're low on disk space but still want to keep your files online, you might consider moving them to compressed ...

Discover More

Checking a Disk Drive for Free Space

Keeping track of your resources can help you avoid serious computer problems. Having an adequate amount of disk space is ...

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 six minus 4?

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


Newest Tips