Backup error on robocopy command

Solved
anakin6661 Posted messages 90 Status Member -  
anakin6661 Posted messages 90 Status Member -
Hello,

I am performing a remote backup of a distant file server to a Western Digital NAS using robocopy.
The command is launched on a server with a domain administrator account.

For the connection to the NAS, I have configured the creation of a network drive with username and password specified.
My .bat is set up to define variables for the source, destination, and date definition.
The destination folder for the log file is created based on the date using md j:\...

My robocopy command is:
robocopy %SOURCE% %DESTINATION%\%year%%month%%day%DIR\ /E /copy:DAT /B /XF thumbs.db /NDL /fp /TS /NP /R:1 /W:1 >> "%destination%\%year%%month%%day%DIR\Log DIR Robocopy %year%-%month%-%day%.txt"

I chose /copy:dat to avoid issues with NTFS permissions.

However, I am encountering an error on many files (222 GB to back up)
<date> <time> ERROR 5 (0x00000005) copying file <\\.....\....\....pdf> ACCESS DENIED

I have the error for all eml files, but also on doc, docx, pdf, ...
I have read that /zb resolves some issues, but the symptoms seem different.
I can't find anything online about this problem.

Does anyone have any ideas?

P.S.: In the original file, there are the commands
for /f "delims=/ token=1,2,3" %%1 in ('echo %date%') do set DA=%%1/%%2/%%3
for /f "delims=/ token=1,2,3" %%1 in ('echo %date%') do set DAFR=%%1-%%2-%%3
for /f "delims=/ token=1,2,3" %%1 in ('echo %date%') do set DAY=%%1/%%2/%%3

But I don't know what these lines correspond to, so I had disabled them.
Thanks to those who respond to us without asking for anything in return other than respect and few mistakes... :)

10 answers

anakin6661 Posted messages 90 Status Member 6
 
Yes, for the config that's it.
I tested the command but I still have my error and the eml file is created but with the date in 1980

--
Thanks to those who respond to us without asking for anything in return except for respect and few mistakes... :)
2
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
Just to test, does it work better if you use the machine where the script is located?
-1
anakin6661 Posted messages 90 Status Member 6
 
No mistakes with this approach.
For the NAS, it's a Western Digital My Cloud 4100 with firmware 2.21.126

--
Thanks to the people who respond to us without asking for anything in return other than respect and few mistakes... :)
1
anakin6661 Posted messages 90 Status Member 6
 
I found the solution, I used /ZB instead of /B and I no longer got any command line errors, it looks like this:
robocopy %source% %destination%\%year%%month%%day%XXX\dir /E /FFT /COPY:DAT /R:0 /W:2 /ZB /XF thumbs.db /V /NDL /FP /TS /NP >> "%destination%\%year%%month%%day%XXX\LOG.txt

Thank you for the help you provided me.
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
Glad your problem is solved.

Thank you for providing the solution.

See you soon, perhaps.
0
anakin6661 Posted messages 90 Status Member 6
 
Given how much I've struggled with this, if it can prevent migraines and increase the burden on social security... You've helped me in the past and well, for once if I can help, it's just a way of returning the favor.
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
Hello,

If you want us to help you, post your entire script.
0
anakin6661
 
I thought I had provided enough info, I'll do this tomorrow when I return to work.
0
anakin6661 Posted messages 90 Status Member 6
 
rem---------------------------------------------------------------------------
rem configuration of NAS access
rem---------------------------------------------------------------------------

net use j: /delete /y
net use j: \\ipNAS\BackupFolder /user:user password

rem ---------------------------------------------------------------------------
rem definition of variables
rem ---------------------------------------------------------------------------

rem source folder
SET SOURCE=\\IPsrvFile\folder to backup

rem destination folder
SET DESTINATION=\\ipNAS\BackupFolder

rem definition of the day
SET day=%date:~0,2%

rem definition of the month
SET month=%date:~3,2%

rem definition of the year
SET year=%date:~6,4%

rem ---------------------------------------------------------------------------
rem creation of the destination directory
rem ---------------------------------------------------------------------------

md j:\%year%%month%%day%DIR
md j:\%year%%month%%day%DIR\log

rem ---------------------------------------------------------------------------
rem ------------
rem ---------------------------------------------------------------------------

rem unknown command

rem for /f "delims=/ tokens=1,2,3" %%1 in ('echo %date%') do set DA=%%1/%%2/%%3

rem for /f "delims=/ tokens=1,2,3" %%1 in ('echo %date%') do set DAFR=%%3-%%2-%%1

rem for /f "delims=/ tokens=1,2,3" %%1 in ('echo %date%') do set DAY=%%1/%%2/%%3

rem ---------------------------------------------------------------------------
rem starting the backup
rem ---------------------------------------------------------------------------

robocopy %SOURCE% %DESTINATION%\%year%%month%%day%DIR\ /E /copy:DAT /R:1 /W:1 /B /XF thumbs.db /NDL /fp /TS /NP >> "%destination%\%year%%month%%day%DIR\log\Log DIR Robocopy %year%-%month%-%day%.txt"

--
Thank you to those who respond to us without asking for anything in return except respect and little faults... :)
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
Sure, what does the log say? Give me the entire log so I can see what works and what doesn't.

You can simulate and generate a log using the /NOCOPY switch

By the way, your first md command is useless.
0
anakin6661 Posted messages 90 Status Member 6
 
I noticed that the eml file was copied well but it couldn't copy the detail information
This includes, among other things, creation and modification date 02.01.1980 at 01:00

Thanks to the people who respond to us without asking for anything in return except respect and few mistakes... :)
0
anakin6661 Posted messages 90 Status Member 6
 

-------------------------------------------------------------------------------
ROBOCOPY :: Robust file copy for Windows
-------------------------------------------------------------------------------

Start: Wed Mar 29 10:27:08 2017

Source: \\IPsrvfichier\backup folder
Dest: \\ipNAS\backupFolder

Files: *.*

Excluded files: thumbs.db

Options: *.* /TS /FP /NDL /S /E /COPY:DAT /B /NP /R:0 /W:1

-------------------------------------------------------------------------------

New file 76288 2014/06/02 09:19:31 \\IPsrvfichier\backup folder\doc1.doc
New file 40960 2014/06/02 09:19:05 \\IPsrvfichier\backup folder\doc2.doc
New file 182926 2014/06/05 08:02:05 \\IPsrvfichier\backup folder\mail.eml
2017/03/29 10:27:09 ERROR 5 (0x00000005) Copying file \\IPsrvfichier\backup folder\mail.eml
Access denied.

-------------------------------------------------------------------------------

Total Copied Skipped Mismatch FAILED Extras
Retry: 1 0 1 0 0 1
Files: 3 2 0 0 1 0
Bytes: 293.1 k 114.5 k 0 0 178.6 k 0
Hours: 0:00:00 0:00:00 0:00:00 0:00:00

Rate: 577576 Bytes/sec.
Rate: 33.049 Megabytes/min.

Finished: Wed Mar 29 10:27:09 2017

--
Thank you to the people who respond to us without asking for anything in return except respect and few mistakes... :)
0
anakin6661 Posted messages 90 Status Member 6
 
In terms of document security, network administrator accounts have full control over all files (it's the GGs listing the admin accounts that are in full control)
I'm thinking about NTFS security, but normally, in the error line report, I should have the following precision:
"ERROR 5 (0x00000005) NTFS security copy in the destination file< directory name > access denied"
Am I wrong?

Thanks to those who respond to us without asking for anything in return except respect and few mistakes... :)
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
If I understood correctly, you have a file server, a NAS, and you are running this script from a third machine, is that right?
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
Try it like this :
net use j: /delete /y
net use j: \\ipNAS\BackupFolder /user:user password

rem definition of the day
SET day=%date:~0,2%

rem definition of the month
SET month=%date:~3,2%

rem definition of the year
SET year=%date:~6,4%

rem source folder
SET SOURCE=\\IPsrvFile\folder to backup

rem destination folder
SET DESTINATION=j:\%year%%month%%day%DIR\

md %destination%
md %destination%log

chcp 1252

robocopy %SOURCE% %DESTINATION% /E /FFT /copy:DAT /R:3 /W:10 /B /XF thumbs.db /V /NDL /FP /TS /NP >> "%destination%log\Log DIR Robocopy %year%-%month%-%day%.txt"

exit
0
anakin6661 Posted messages 90 Status Member 6
 
Copy the test folder content on the machine launching the .bat file while preserving the same AD rights.
No change, same error. Access denied to the eml file but still copying it with the date parameters set to 1980.

--
Thanks to those who respond to us without asking for anything in return other than respect and few mistakes... :)
0
barnabe0057 Posted messages 14329 Registration date   Status Contributor Last intervention   4 930
 
We exclude the NAS, you copy the content from the file server to the machine running the script.
0