Robocopy reporting failed files but not showing in logs - windows

I am running a robocopy script to sync data from an old file server to a new one. Im running into an issue where the log is stating that there's 600+ failed files but the logs don't indicate any failed files.
For reference, here is the commands I'm running:
robocopy \fileserver\c$\FolderRedirection C:\FolderRedirection /XD $recycle.bin /R:0 /W:0 /S /E /Tee /Log:C:\robo\FolderRedirection.log /V /MIR /secfix /Copy:DATS /efsraw
robocopy \fileserver\c$\Shares C:\Shares /sec /R:0 /W:0 /S /E /Tee /Log:C:\robo\data.log /V /MIR /secfix /Copy:DATS /efsraw
pause
Anyone have any ideas on what I'm missing?

I ran into the same issue and found the following workaround/behavior.
At first I ran my robocopy command without /efsraw and had only a problem with one file being efs-crypted - but no other failed files.
So I added the /efsraw and now found hundreds and thousands of failed files stated in the robocopy-summary, but found no corresponding log-lines.
After removing /efsraw robocopy ran without any failed files stated in the summary.
So it seems to me, that /efsraw is a bit problematic...

Related

How To Move Files With Batch File

I'm trying to move files with batch file and thats work but ı don't wanna move files inside the appdata. How can I skip AppData files.
#ECHO OFF
Robocopy C:\Users\%User%\ C:\NewFolder\ /E /MOV
EXIT
Try using something like this :)
Robocopy C:\Users\%User%\ C:\NewFolder\ /E /Z /ZB /R:5 /W:5 /TBD /V /XD C:\Users\%User%\AppData
Here are the subcommands I've used
/E — Copy Subdirectories, including empty ones.
/Z — Copy files in restartable mode.
/ZB — Uses restartable mode, if access denied use backup mode.
/R:5 — Retry 5 times (you can specify a different number, default is 1 million).
/W:5 — Wait 5 seconds before retrying (you can specify a different number, default is 30 seconds).
/TBD — Wait for sharenames To Be Defined (retry error 67).
/V — Produce verbose output, showing skipped files.
/XD — Excludes folders matching the path and folder name

robocopy using secfix to fix permissions of ONLY subdirectories, excluding root directory

I have a rather interesting issue that I think is logically possible via Robocopy, but I cannot find the correct syntax to accomplish this goal.
Problem:
I am trying to sync a lot of data via two remote shares. IE: robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64
The issue arises due to the fact that the root directory has different permissions than all of the subdirectories. I have close to 1000 subdirectories that makes this tedious and difficult to manually do.
Current Issue
Running 'robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' changes ONLY the permissions of the root directory, but not the subdirectories.
Running 'robocopy "\share1\root\subdirectory1" "\share2\root\subdirectory1" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' DOES result in the desired state, but is far too tedious to do for over 1000 sub directories
Desired Results
Either a robocopy command that would ONLY change the permissions on the subdirectories (and the child elements within those directories) but maintain the perms on the root directory, or another means of accomplishing the above.
Any help would be appreciated!
I guess you can technically use PowerShell to automate looping through your directory tree.
Get-ChildItem -Path '\share1\root' -Directory | Foreach-Object {
robocopy "\share1\root\$($_.Name)" "\share2\root\$($_.Name)" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64
}

how to list up all directory and files (include sub directory) without access right?

I bought a new file server.
I want to copy all file and directories.
I tried this.
cmd
robocopy d:\ \\10.226.0.12\full_backup\ /R:3 /E /ZB /COPYALL /LOG:backup_log.txt
Then, we have to compare file and directories, for find missing copy file.
I tried this.
cmd
tree d:\ /F > out.txt
But, administrator can't access any file and directories.
what should i do?
robocopy is using "Backup Operators".
I think, use "tree" command with "Backup Operators", then perfect work.
there is the problem with administrators group can not access any file and folders.
How to solve this.
take ownership.
bat
takeown /F D:\ /A /R /D Y
list up files. (thx for this command. JosefZ)
bat
dir /B /S /A /O:NE d:\*.*
In other words, you don't turn off administrators group access. forever.
Even if there is any reason.

Robocopy to show percentages but not each file being copied

I've been reverse engineering other code (being that I don't know much about batch writing at all) to backup specific subfolders. Right now, it looks like this:
#echo off
for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a
mkdir "e:\Family Sync Folder Backup\%date:/=_%"
set source= "\\jessica\Family Sync Folder"
set destination= "e:\Family Sync Folder Backup\%date:/=_%"
robocopy %source% %destination% /e
This code is repeated for specific subfolders.
I was wondering if there was a way to print onto screen something like "Currently Backing Up (FOLDER NAME)" followed by a percentage but without listing each file.
Bonus points for creating a log file which does display each file copied.
You can use
robocopy %source% %destination% /e /LOG:"YourLogFile.txt"
to force robocopy into writing a log, or, to supress robocopy output and log at the same time you can
robocopy %source% %destination% /e >> YourLogFile.txt
Now, notice that most of Robocopy's output on screen will be supressed and will put you a blank blinking line until its over, to use this second option you'll have to write down a different method to copy in a batch so you can (on each iteration) get the actual number of files/folders copied (times 100) and divide by the total amount to get the % completed and display it on screen.
if you want to display a different progress indication you'll need the total amount of files and the amount of files copied, for that you'll end up using a for loop with dir command and probably lose the whole functionality of robocopy.
Or you can get use of these 5 options on robocopy:
robocopy %source% %destination% /mir /LOG+:Yourfile.txt /NFL /NDL /NJH /NJS /nc /ns
/NFL : No File List - don't log file names.
/NDL : No Directory List - don't log directory names.
/NJH : No Job Header.
/NJS : No Job Summary.
Ctrl+v'd from:
How can I make robocopy silent in the command line except for progress?
Note that % progress is shown per file on robocopy but not per directory.

copying all contents of folder to another folder using batch file?

I have a folder: C:\Folder1
I want to copy all the contents of Folder1 to another location, D:\Folder2
How do I do this using a batch file?
xcopy.exe is the solution here. It's built into Windows.
xcopy /s c:\Folder1 d:\Folder2
You can find more options at http://www.computerhope.com/xcopyhlp.htm
If you have robocopy,
robocopy C:\Folder1 D:\Folder2 /COPYALL /E
otherwise,
xcopy /e /v C:\Folder1 D:\Folder2
I see a lot of answers suggesting the use of xcopy.
But this is unnecessary. As the question clearly mentions that the author wants the content in the folder not the folder itself to be copied in this case we can do
copy "C:\Folder1\*.*" "D:\Folder2"
Thats all xcopy can be used for if any subdirectory exists in C:\Folder1
if you want remove the message that tells if the destination is a file or folder you just add a slash:
xcopy /s c:\Folder1 d:\Folder2\
RoboCopy did not work for me, and there are some good solutions here, but none explained the XCopy switches and what they do. Also you need quotes in case your path has spaces in it.
xcopy /i /e "C:\temp\folder 1" "C:\temp\folder 2"
Here is the documentation from Microsoft:
XCopy MS Documentation
/s: Specifies to include subdirectories. Excludes empty subdirectories
/e: Copies all subdirectories, even if they are empty
/i: specifies the destination is a folder (Otherwise it prompts you)
Here's a solution with robocopy which copies the content of Folder1 into Folder2 going trough all subdirectories and automatically overwriting the files with the same name:
robocopy C:\Folder1 C:\Folder2 /COPYALL /E /IS /IT
Here:
/COPYALL copies all file information
/E copies subdirectories including empty directories
/IS includes the same files
/IT includes modified files with the same name
For more parameters see the official documentation: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
Note: it can be necessary to run the command as administrator, because of the argument /COPYALL. If you can't: just get rid of it.
#echo off
::Ask
echo Your Source Path:
set INPUT1=
set /P INPUT1=Type input: %=%
echo Your Destination Path:
set INPUT2=
set /P INPUT2=Type input: %=%
xcopy %INPUT1% %INPUT2% /y /s
On my PC, xcopy and robocopy need also the path to them, i.e. C:\Windows\System32\xcopy.exe
That's why I use simply "copy":
copy /y ....\Folder1\File.txt ....\Folder2\
#echo off
xcopy /s C:\yourfile C:\anotherfile\
This is how it is done!
Simple, right?
FYI...if you use TortoiseSVN and you want to create a simple batch file to xcopy (or directory mirror) entire repositories into a "safe" location on a periodic basis, then this is the specific code that you might want to use. It copies over the hidden directories/files, maintains read-only attributes, and all subdirectories and best of all, doesn't prompt for input. Just make sure that you assign folder1 (safe repo) and folder2 (usable repo) correctly.
#echo off
echo "Setting variables..."
set folder1="Z:\Path\To\Backup\Repo\Directory"
set folder2="\\Path\To\Usable\Repo\Directory"
echo "Removing sandbox version..."
IF EXIST %folder1% (
rmdir %folder1% /s /q
)
echo "Copying official repository into backup location..."
xcopy /e /i /v /h /k %folder2% %folder1%
And, that's it folks!
Add to your scheduled tasks and never look back.
I have written a .bat file to copy and paste file to a temporary folder and make it zip and transfer into a smb mount point,
Hope this would help,
#echo off
if not exist "C:\Temp Backup\" mkdir "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%"
if not exist "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\ZIP" mkdir "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\ZIP"
if not exist "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\Logs" mkdir "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\Logs"
xcopy /s/e/q "C:\Source" "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%"
Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\Logs"
"C:\Program Files (x86)\WinRAR\WinRAR.exe" a "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\ZIP\ZIP_Backup_%date:~-4,4%_%date:~-10,2%_%date:~-7,2%.rar" "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\TELIUM"
"C:\Program Files (x86)\WinRAR\WinRAR.exe" a "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\ZIP\ZIP_Backup_Log_%date:~-4,4%_%date:~-10,2%_%date:~-7,2%.rar" "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\Logs"
NET USE \\IP\IPC$ /u:IP\username password
ROBOCOPY "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%\ZIP" "\\IP\Backup Folder" /z /MIR /unilog+:"C:\backup_log_%date:~-4,4%%date:~-10,2%%date:~-7,2%.log"
NET USE \\172.20.10.103\IPC$ /D
RMDIR /S /Q "C:\Temp Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%"
#echo off
:: variables
echo Backing up file
set /P source=Enter source folder:
set /P destination=Enter Destination folder:
set xcopy=xcopy /S/E/V/Q/F/H/I/N
%xcopy% %source% %destination%
echo files will be copy press enter to proceed
pause

Resources