0

Can we use robocopy to copy random x number of files from one network share to another in Windows server 2008/ Windows server 2003?

2 Answers2

3

Depends what you mean by random.

enter image description here

enter image description here

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.

robocopy \\server1\here \\server2\there e*.jpg

If you mean "Pick from a limited few subsets of files, but randomly choose which subset each time", then how about:

robocopy \\server1\here \\server2\there /lev:%random~:1,1%

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.

TessellatingHeckler
  • 5,676
  • 3
  • 25
  • 44
1

If x is a number, not unless you can use the file names for some sort of include rule.
If you just mean the contents of a directory and/or the contents of a directory and it's subfolders, yes.

For network operations remember to use /Z

84104
  • 12,698
  • 6
  • 43
  • 75