I have the following Robocopy command. Currently it outputs all directories it is traversing during the mirror but I only want it to output what actually got synced from source to destination. I'm not seeing a "only show differences" option in the documentation.
robocopy "C:\inetpub\example.com" "Z:\D Drive\Projects\example.com\Web\example.Web" /mir /xd "C:\inetpub\example.com\wp-content\mu-plugins\example-network" "C:\inetpub\example.com\wp-
content\plugins\example" "C:\inetpub\example.com\wp-content\themes\example" ".git"
Of course I figured it out right after I posted the question. Here is my new command. The /fp /ns /ndl options did the trick.
robocopy "C:\inetpub\example.com" "Z:\D Drive\Projects\example.com\Web\example.Web" /mir /fp /ns /ndl /xd "C:\inetpub\example.com\wp-content\mu-plugins\example-network" "C:\inetpub\example.com\wp-content\plugins\example" "C:\inetpub\example.com\wp-content\themes\example" ".git"
Meaning of switches
From SS64 entry:
/FP : Include Full Pathname of files in the output.
[...]
/NS : No Size - don’t log file sizes.
[...]
/NDL : No Directory List - don’t log directory names.
Related
I had THOUGHT that RoboCopy logs could show the action for individual files, i.e. differentiate between a file copied new because it didn't exist in the destination vs file updated because it does exist but is different. But the last time I worked with RoboCopy was Windows 7, and now in Windows 10 I am not seeing anything that looks like a way to get that information in the logs. Am I misremembering, and that was never an option? Or did that functionality get removed? Or am I just missing the argument to make that happen?
FWIW, this is my argument string at the moment
RoboCopy $sourceFolder $destinationFolder /mir /mt /fft /copy:dat /r:10 /w:5 /log:$mirrorLogPath /njh /ns /nc /np
The problem is: With this command, only files are copied, the folder structure is not copied. What can I do to fix it?
robocopy \\FSMTT2\P$ H: /J /MIR /COPYALL /ZB /W:5 /R:2 /XJ /XD "System Volume Information" "$Rec*"
"Boot" /XF "pagefile.sys" /mT:128
The problem is: With this command, only files are copied, the folder structure is not copied. What can I do to fix it?
If you are using /MIR not need to use /COPYALL.
When running robocopy I am experiencing the following. Can you correct/explain what is happening, please?
I get an extra directory under the total column and 1 skipped directory. Yet the number of files in total and copied columns are the same?. Note the number of bytes is also the same.
One of my directories appears to copy all but hangs up in some kind of a loop necessitating a restart of robocopy. I am never confident that the copy is ok. How can I identify the problem?
Options listed in the log are different than those specified.
robocopy "E:\mmarion.4" "D:\mmarion.4" /E /256 /NC /NFL /NS /NDL /NP /TEE
becomes
Options : *.* /256 /NS /NC /NDL /NFL /TEE /S /E /DCOPY:DA /COPY:DAT /NP /R:1000000 /W:30
Thank you. MM
For part 3: Even if you don't specify some options, the output tells you which options are getting applied. In the case you quoted, the following are defaults, so they appear in the output even though you didn't include them in your command.
/DCOPY:DA
/COPY:DAT
/R:1000000
/W:30
The other odd one is /S. You specified /E, and Robocopy reports both /E and /S when you do that. That's technically a bit misleading, because /S means "... but not empty ones", and /E means "... including empty ones", so it can't really be both at the same time. But if you think of /S as meaning "... non-empty subdirectories" and /E meaning "... both empty and non-empty subdirectories", then having /E expanded to both /S and /E is not unreasonable.
I'm having trouble getting this to work properly, I'm trying to copy every file from an external HDD to my NAS device, and i only wanted to see in the logfile what are the files that have been skipped or not copied, this is what i used after reading on the forums:
Robocopy E:\ "\\NAS" /e /v /nfl /ndl /njh /njs /ns /nc /np /log+:"C:\Users\xx\Desktop\log.txt"
For some reason, it doesn't save anything to the logfile when it's done, completely empty. Yet when i check the file and folder properties of both HDD and the Backup folder it shows that there are over 50,000 files that have NOT been copied.
I am trying to run a robocopy script in PowerShell so I can insert it into my other PowerShell script:
$SERVERPATH = "E:\Cisco Config Backups"
$NETWORKPATH = "\\SERVER\Cisco Config Backups"
robocopy $SERVERPATH $NETWORKPATH /E /XC /XN /XO /R:0 /W:0 /COPY:T /LOG:C:\logs\robocopy_logs\config_copy.log /TEE /NP
However when I run this code I see robocopy working where it gives me the following output:
ROBOCOPY :: Robust File Copy for Windows
Started : Thursday, June 30, 2016 1:52:56 PM
Source : E:\Cisco Config Backups
Dest : \\SERVER\Cisco Config Backups
Files : *.*
Options : *.* /TEE /S /E /DCOPY:D /COPY:T /NP /XO /XN /XC /R:0 /W:0
But nothing gets copied over, I want to use robocopy for the logging and so I can have it skip files that already exist.
Please let me know if I am doing anything wrong.
The /COPY:T criteria is specifying to only copy file timestamps, so it is not copying the actual data of the file. However, since there are no files on the destination to copy the timestamps to, nothing happens.
You need to specify at least /COPY:DT so that the file data will be copied, but you can probably just remove the /COPY switch completely as you likely want the file attributes as well, which will get copied by default along with the file data and timestamps.
From robocopy /?:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info)
You also need to review all of the switches you are using as some are conflicting--not sure what robocopy does in those cases. As Matt points out in the comment below, you have /E and /S. Do you want to copy empty subdirectories or not? /E specifies to copy empty directories, but /S specifies to NOT copy empty directories.