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

Creating a System Repair Disk on a USB Flash Drive

Having a system repair disk is almost as important as doing regular backups. CDs and DVDs, though, tend to get scratched ...

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

KeePass Password Safe

If you feel overwhelmed by the number of usernames and passwords you have to remember, KeePass Password Safe is your ...

Discover More
More WindowsTips

Displaying All the Files in a Folder using Explorer

Displaying all the files a folder contains is an easy task in Windows. One easy way to do it is by using the Windows ...

Discover More

Copying Data with XCopy

XCopy is a file and directory copy utility built into Windows. If you have a lot of file management to do that can't ...

Discover More

Turning On the Display of File Extensions

Windows is configured, by default, to hide file extensions. This could be confusing or outright dangerous. For example, ...

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 five more than 3?

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


Newest Tips