Questions tagged [robocopy]

Robocopy is a command line file copy utility for Windows-based operating systems.

Robocopy is a Microsoft command line file copy utility that is built into Windows Server versions 2008 R2 and newer. Examples of basic functionality include directory mirroring, copying files over a network, restartable copy and multiple exclusion/inclusion flags.

Official documentation was last seen at: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

280 questions
146
votes
4 answers

robocopy transfer file and not folder

I'm trying to use robocopy to transfer a single file from one location to another but robocopy seems to think I'm always specifying a folder. Here is an example: robocopy "c:\transfer_this.txt" "z:\transferred.txt" But I get this error…
Bill McKay
37
votes
8 answers

How to get robocopy running in powershell?

I'm trying to use robocopy inside powershell to mirror some directories on my home machines. Here's my script: param ($configFile) $config = Import-Csv $configFile $what = "/COPYALL /B /SEC/ /MIR" $options = "/R:0 /W:0 /NFL /NDL" $logDir =…
Mark Allison
  • 2,278
34
votes
2 answers

What switches can robocopy use to preserve file and directory times on the target?

After using robocopy to copy files to a new drive I realized that all the file and directory creation times and been reset to the time of copying. Are there some switches to make robocopy keep the original files times?
vfclists
  • 1,702
30
votes
11 answers

Robocopy: How to move the content of a directory but KEEP the directory

Simple task: Move all the content of the directory c:\Users\files\Desktop\test 2 to c:\Users\files\Desktop\test 1 C:\admin\temp>robocopy "c:\Users\files\Desktop\test 2" "c:\Users\files\Desktop\test" *.* /S /MOVE Sounds reasonable, but now, the…
perler
  • 551
29
votes
1 answer

robocopy is 20x slower than drag/droping files between servers

I am migrating 20TB of files between two servers. Both systems are Windows 2012R2 with latest updates installed. Both using gigabit network. Using robocopy on the new server with the command line robocopy /S /ZB /MOVE /J /DCOPY:A /V /FP…
Grant
  • 18,125
  • 14
  • 75
  • 104
26
votes
4 answers

Can Robocopy be made to skip open files?

We are using Robocopy to redistribute files which arrive via FTP in a drop folder. Ideally we want Robocopy to leave files alone if they are still being FTPd. Having tried various switches, Robocopy still copies the open files. It doesn't delete…
domspurling
  • 363
  • 1
  • 4
  • 5
23
votes
8 answers

The Job and Monitoring Options of RoboCopy

What does the Job Options of RoboCopy do? And what exactly does the /MON and /MOT switches do? How can I use them? I don't understand them, and can't find any examples on how to use them. /MON:n - MONitor source; run again when more than n changes…
Svish
  • 7,527
20
votes
3 answers

On Windows: is it safe to do a robocopy in order to clone the system?

Let me start by giving a bit of a background. On Linux systems, I frequently rely on the fact that as long as I can get all files over from one hard drive to another, and as long as I fix up the boot loader, I'll be left with an identical,…
ixnaum
  • 203
20
votes
4 answers

Wildcard directory exclusions with robocopy -- weird case

I need to get robocopy to exclude any file whose path contains a directory with a particular name. For example, "bar": c:\foo\bar\a.txt c:\bar\c.txt d:\baz\bar\flub\d.txt should be excluded, but not c:\foo\barf\b.txt Here are the things I tried --…
Jesse
  • 1,920
18
votes
1 answer

User accidentally messed up a Robocopy command and caused a bunch of folders to get created with corrupt security

We had a user run a robocopy command to copy some files but unfortunately the user accidentally messed up the syntax. Something like: robocopy "\\server1\share\Accounting" \\server1\share\NewAccounting" /E /X /COPYALL /TEE Which without the proper…
TheCleaner
  • 33,047
17
votes
3 answers

Exclude only some files with the same name when copying using robocopy

I have a directory structure like this: folder1\ help.txt folder2\ help.txt folder3\ help.txt ... I want to copy the contents of folder1 using robocopy. For example: robocopy folder1 destination /E I want to exclude…
14
votes
1 answer

What is a S-X-X-XX-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXX-XXXX called in Windows security?

I copied two trees, a source and a destination, that I copied with robocopy like this: robocopy /MIR C:\Windows\System32\tasks\ C:\temp\robocopyTasks\out\ robocopy /E /Copy:S /IS /IT C:\Windows\System32\tasks\ C:\temp\robocopyTasks\out\ Then I…
leeand00
  • 5,051
14
votes
4 answers

Why does RoboCopy create a hidden system folder?

I thought I would try out RoboCopy for mirroring the contents of a folder to another harddrive. And seems like it worked. But, for some reason, to see the destination folder I have to both enable Show hidden files, folders and drives and disable…
Svish
  • 7,527
13
votes
5 answers

Apparently Robocopy does not understand Windows Server 2016 deduplication. Is there a way to make it work without corrupting the volume?

Scenario: Doing a server migration from old Server 2008 R2 to new Server 2016, following this Server Fault guide: File server migration using Robocopy After Robocopy completes, enable deduplication on Server 2016 for the copied volume, and then use…
13
votes
3 answers

How do I use robocopy with a large number of excluded files?

I want to use robocopy to move a large number of files, except those that are in a whitelist. The whitelist contains approximately 150 files of different names. When I copy-and-paste the whitelist's filenames into the command line (using the /xf…
1
2 3
18 19