Run Robocopy in "Report Only" Mode - robocopy

I have a fairly simple robocopy command here that I want to run that will upload files to an Azure storage account. The problem I have is I'm looking at approxiately 70,000 files but a lot of these already exist in the storage account.
What I want to do is run the command in a "Log Only" or "whatif" mode so I can see how many files will be copied and how many will be skipped. This command gives that detail but will perform the copy. Is there a switch I can add that will simply provide the log and NOT copy the files?
S:\inbound\ \\<storageaccount>\<filesharename>\inbound\ /r:3 /w:3 /e /xo /xx /LOG:Robocopy_20200313_Manual.txt

Yes, you may try the switch /L which means List Only but Will Not Copy any files or Change any attributes.

Related

How do I protect against file corruption when using robocopy restartable mode?

I have a powershell script that that copies published files for a web app to a server for deployment. It utilizes robocopy to copy the files. Due to lack of administrator privileges, I can only use restartable mode (/z) and not restartable mode with backup mode (/zb). My question is two parts:
How reliable is robocopy using restartable mode- how likely are files to become corrupted?
What would be the best way to incorporate into the script a check to see whether a file has corrupted during the copying process?
Here is a sample of my code:
robocopy /s /z /ndl /r:0 /w:0 /mt:32 .\Publish "DESTINATION_HERE" /MIR

Using xcopy instead of robocopy for wildcarded files

I'm working on an old 2003 server and I want to copy a folder for specific files while also retaining the folder structure.
Note: I am not allowed to install or add robocopy onto this server.
The command that I use on another server is usually something like this.
robocopy Application Application_small *.txt /E
This, of course, gives me a new directory with nothing but the .txt files and the same folder structure.
But of course, robocopy isn't on Server 2003. However, xcopy does exist. Is there an equivalent switch that I can use to get the same kind of result as robocopy?
Similar question was found here.
xcopy Application\*.txt Application_small /s

Robocopy - ERROR 124 (0x0000007C) Creating Destination Directory

Hoping someone familiar with Windows 10 and Robocopy can help.
I am using the following robocopy command in backup script that is being run as Administrator (yes the real Administrator user ID)
runas /user:Administrator backup.bat
robocopy N:\FNL E:\FNL /MIR /E /Z /R:1 /W:1 /V /NP /LOG+:backup.log
As long as there have been no new files for directories created in the source folder, in this case N:\FNL it seems to run fine. As soon as I create a directory, for example "Fred", I get the following error:
ERROR 124 (0x0000007C) Creating Destination Directory N:\FNL\Fred
The system call level is not correct.
I have changed file permission for "Authenticated Users" to Full Control and as well have taken ownership of all folders and sub-folders/child objects on the target drive but still get the same error.
Anyone have an idea what I might be doing wrong?

Bat Backup Script

What I am trying to do is to backup a user profile from their local workstation to our backup servers and send me an email once it's complete. I currently have this is two different scripts. It would be nice if we could make this in one script. If I need two scripts, that won't be a problem.
The first script is the backup, and it has been working just fine.
robocopy C:\Users\TravisWhiteman.ArchwaySys\AppData \\10.1.10.6\WorkstationBackup\Test\AppData /mir /W:3 /R:1 /log:CopylogAppData.txt
robocopy C:\Users\TravisWhiteman.ArchwaySys\Desktop \\10.1.10.6\WorkstationBackup\Test\Desktop /mir /W:3 /R:1 /log:CopylogDesktop.txt
robocopy C:\Users\TravisWhiteman.ArchwaySys\Documents \\10.1.10.6\WorkstationBackup\Test\Documents /mir /W:3 /R:1 /log:CopylogDocuments.txt
robocopy C:\Users\TravisWhiteman.ArchwaySys\Downloads \\10.1.10.6\WorkstationBackup\Test\Downloads /mir /W:3 /R:1 /log:CopylogDownloads.txt
Now I want to add in a few features, and I don't know how. I want to change it from manually setting the user profile directory to the system automatically find out who the user is. I think it's something like %USERNAME%. The goal is having the system figure the user out is so I don't have to change the C:\Users\TravisWhiteman.ArchwaySys for every workstation. All of our workstations turns on automatically, 10 min before the scheduled task to backup, in case a user were to shut off their computer.
Basically, what you need is the profile path of the currently logged on user for a list of remote computers.
Steps for each computer:
Get the currently logged on user's login name (here is the method I currently use)
Get the SID for this user - let's say $userSID (a method is described here)
Browse this registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$userSID on the remote computer, and read the value ProfileImagePath, it holds the local profile path for this user on this computer (example of remote registry access)
Convert the local path to a network path (C:\Users\... -> \\computerName\c$\Users)
Call robocopy and get some coffee (removed coffee from loop)
One could simply go for \\computer\c$\Users\$userLogin but as OP's example demonstrates it, Windows sometimes appends your domain name to your user name in your local profile folder name, in quite an unpredictable fashion.
(the Remote Registry service must be running on the remote computers)
If the workstation was shut down and then awoken, you I'd target the last modified folder in C:\Users.

please give the command in Robocopy i should use to copy the files from primary server to the secondary server

I got the command in robocopy as mentioned below
ROBOCOPY Source Destination [file…[file]…..] [Options]
Source: Source Directory
Destination: Destination Directory
Files: files to copy .
Please let us know what does the "\server\share\path" means? Kindly provide me an example on this command syntax and explain
An example of a ROBOCOPY call would be
ROBOCOPY C:\Users \\SERVER\backup\Users /MIR /R:0 /W:0
This copys everything under C:\Users to a network share at the UNC path \\SERVER\backup. If you don't know, what that means, google for 'UNC path' or find a nice tutorial that explains how to setup network shares under Windows.
Instead of \\SERVER\backup, that copies to a remote machine, you are totally free to use something like H:\ to copy to a local drive like a USB mass storage device.
The part /MIR /R:0 /W:0 are options of ROBOCOPY. Call ROBOCOPY /? to get an explanation for these.
Cheers,