Can we use robocopy to copy random x number of files from one network share to another in Windows server 2008/ Windows server 2003?
migrated from stackoverflow.com Aug 12 '11 at 22:57
This question came from our site for professional and enthusiast programmers.
Depends what you mean by random.
Robocopy doesn't have a "copy some files at random and not others" flag, but it does support wildcard file selection. If you would accept "out of all my files, pick some specific files such that I don't know in advance how many, but I could know and will be the same every time" then you could specify, e.g.
If you mean "Pick from a limited few subsets of files, but randomly choose which subset each time", then how about:
to choose a random folder depth cutoff each time, or /max:%random% to choose a random filesize cutoff... see The Robocopy Docs for more fun options.
If x is a number, not unless you can use the file names for some sort of include rule.
For network operations remember to use