Robocopy Error 3 "System cannot find the file specified" for 1 file in the folder - robocopy

I am trying to copy a folder from the network path to my machine .But while copying the folder the robocopy suddenly got stuck in copying 1 file from the folder and did not proceed forward . I am seeing the error ERROR 3 (0x00000003) , "The System cannot find the path specified." , even though the file did exist in the source directory.
The command that I use is
ROBOCOPY source destination /MIR /Z /Log+:logs.txt
I am seeing this issue when my executable is triggered by the task scheduler. This issue does not happen when i run the exe directly. Any idea why this could be happening and also how to fix this problem

When robocopy claims it cannot find a file, it often means it is running into permission issues. If your script works from the command line, but not from the task scheduler, make sure the task uses your user credentials. You can set them in the task properties on the general tab under security options.

Related

Robocopy with logs

I want to use robocopy for one copying work where whole directory and it's subdirectories with files needs to be copied, but also the log files must contains the logs of copied as well skipped files details. I was using below command robocopy src dest /e /logs:dest
But it's not working for me, can anyone please suggest the required command that can be used for this purpose. Thanks.

Scheduled task : Error 0X3 but Log doesn't give any error

I have several tasks using Robocopy.exe, On One of those tasks, I get a error result 0X3 but the log file doesn't display any error.
Here is the command :
ROBOCOPY \\X\L$\FORMATION \\Y\O$\FORMATION /MIR /sec /W:2 /R:5 /log:c:\O_journal.log
I tried to launch it without the task scheduler, it worked fine without ant errors.
I know that the error 0X3 is : ERROR_PATH_NOT_FOUND.But the log file doesn't display any error.
If someone have any clue or any methods...
This is a standard behavior and relates to exit codes from Robocopy:
0×00 0 No errors occurred, and no copying was done.
The source and destination directory trees are completely synchronized.
0×01 1 One or more files were copied successfully (that is, new files have arrived).
0×02 2 Some Extra files or directories were detected. No files were copied
Examine the output log for details.
0×04 4 Some Mismatched files or directories were detected.
Examine the output log. Housekeeping might be required.
0×08 8 Some files or directories could not be copied
(copy errors occurred and the retry limit was exceeded).
Check these errors further.
0×10 16 Serious error. Robocopy did not copy any files.
Either a usage error or an error due to insufficient access privileges
on the source or destination directories.
And a combination of them, ie: 0x03 = 0x02 + 0x01
See https://blogs.technet.microsoft.com/deploymentguys/2008/06/16/robocopy-exit-codes/ for a complete explanation.
This is an issue to the path configured on the robocopy script. I have fixed this issue by adding the root directory or the main drive to both source and destination.
Note: Please make sure that you are an administrator to both Servers (source and destination)
Example:
Source: "\\192.168.1.2\e$\my files"
Destination: "\\192.168.1.5\d$\backup"
The root directory or the main drive that I have referred is the "e$" and "d$" as shown above. If this will not included in your script, you will be encountering the "0X3" error in the Scheduler and the scheduler will not works.
Note: This script is to synchronize/replicate the file from the source to destination.
Parameters used. /MIR /E /Z /R:5 /W:5
This is how the script looks as a whole:
robocopy "\\\192.168.1.2\e$\my files" "\\\192.168.1.5\d$\backup" /MIR /E /Z /R:5 /W:5
Hope this might help.
Thanks.
Xian

Matlab, dos() command : files remain "in use"

After executing some simple commands like
dos('copy *.txt new.txt', '-echo')
dos('echo. 2 > EmptyFile.txt', '-echo')
I tried to delete the folder in which these files were created. However, Windows gives me the message
"cannot delete "FolderName": the folder is being used by another person/program".
I have to close Matlab to make it work.
How do I solve this? I guess it's something like closing the "session" of cmd commands...
What you're not showing is the change of working directory to your folder. Windows won't let you delete a folder that a process has as a current working directory.
The solution is simple: change the working directory out of that folder. Say:
cd('..')

Execute robocopy powershell continuously between two times established

I have a program that creates temporary files in a specific folder. Then, automatically, after a few seconds, these files are deleted.
I wanted to copy those temporal files to an specific folder, I would like to use a powershell script to do this:
robocopy startFolder destinationFolder *.TIFF *.JPEG *.jpg *.PNG *.GIF *.BMP *.ICO *.PBM *.PGM *.PPM /s /XO
My problem is that I couldn't use a scheduled task (because of the problem with limitation of seconds) or install this powershell as a Windows Service with a powershell script (as far as I know is a bad practice) . I need this powershell running all the time trying to get files at the moment that they are created, before this folders were deleted.
Could you give me a hand please? Thanks!
Not sure it's quite what you want, but robocopy does have directory monitoring funcitonality built-in. You could add /mon:1 which should monitor the source directory and re-run the copy when it detects one change (a new or changed file, for example).
However, a down-side of this perhaps is that using this method, robocopy won't exit - it will run until you kill it.
Edit: I've just noticed you specify in your question title that this should run between two established times, in which case you could add the /rh:hhmm-hhmm option to specify times between which new copies can be started. For example, /rh:1000-1200 should only perform the copies (and hence monitoring) between 10am and midday.
Caveat: I've not tried using the "monitor" option of robocopy, so I'm not sure what sort of delay there would be between a change taking place, and the copy being re-run, but it's worth a shot.

After Robocopy, the copied Directory and Files are not visible on the destination Drive

I've been happily using robocopy for backing up my computers to an external usb drive. It's great since it only copies the files that were changed/updated/new. I can take my external drive to any machine and look at it just as if it's another drive on the computer.
I've recently purchased a 750g and another 1tb external hard drives. I ran a robocopy over the weekend that copied about 500g to my external drive. After the copy My Computer shows that ~500g has been used on the external drive. The strange thing is that when I click on the drive in Windows Explorer, nothing shows up in the right pane of Windows Explorer (and the + goes away in the left pane). I copied a single file (drag-and-drop) to this drive and it shows up in Windows Explorer. Command Prompt show the same thing. 1 file.
I know the files are on the drive as it shows up as the Free Space has been reduced.
I read that I should make sure simple file sharing is off, which it is. I also took ownership of the files as Administrator. Still nothing. It works the same on my WIndows XP machine and my Windows 7 Ultimate.
Has anyone else seen this? Or even better, does anyone know what I am doing wrong or how to solve this problem?
thanks!
Bill44077
In my case, the above didn't work.
This worked instead: attrib -h -s -a [ Drive : ][ Path ].
For example: attrib -h -s -a "C:\My hidden folder".
When copying from the root directory of a drive to a folder (non-root directory on a different drive), this can happen.
RoboCopy may set the new directory to hidden, as it copies the system attribute of the root folder of the drive over to the new folder.
You can prevent the new directory from becoming hidden by adding the /A-:SH option/flag/switch to your robocopy command.
See this Server Fault Answer to "Why does RoboCopy create a hidden system folder?
" for more information.
However, this may or may not prevent copying system attributes in other folders, according to this discussion on the Microsoft forum "ROBOCOPY hides destination Directory".
Here is an example taken from my longer, more thorough, Answer on Super User to the Question "How to preserve file attributes when one copies files in Windows?":
Robocopy D:\ C:\D_backup /A-:SH /DCOPY:T /COPYALL /E /R:0 /ZB /ETA /TEE /V /FP /XD D:\$RECYCLE.BIN /XD "D:\System Volume Information" /LOG:C:\D_backup_robocopy.LOG /MIR
However, if you already copied the directory without the /A-:SH option, running the command mentioned by Ricky above (attrib -h -s -a [ Drive : ][ Path ]) will fix the issue by unhiding the directory. Though, I found that -a was not needed.
So in my case, for the example above, attrib -h -s C:\D_backup (without the -a option) made D_backup visible.
Just ran into this issue myself, so it may be a late response and you may have worked it out already, but for those stumbling on this page here's my solution...
The problem is that for whatever reason, Robocopy has marked the directory with the System Attribute of hidden, making it invisible in the directory structure, unless you enable the viewing of system files.
The easiest way to resolve this is through the command line.
Open a command prompt and change the focus to the drive in question (e.g. x:)
Then use the command dir /A:S to display all directories with the System attribute set.
Locate your directory name and then enter the command ATTRIB -R -S x:\MyBackup /S /D where x:\ is the drive letter and MyBackup is your directory name.
The /S re-curses subfolders and /D processes folders as well.
This should clear the Read Only and System attributes on all directories and files, allowing you to view the directory normally.
In addition to the great answers SherylHohman and Ricky left I wanted to add that merely adding the /A-:SH switch for robocopy did not work and the copy created a hidden, system folder on the destination drive.
However, using the /A-:SHA parameter did work and my top level destination directory was not given the system or hidden attributes. Weirdly, my drive does not have the "a" (archived) attribute set so I am dumbfounded as to why this works at all. I do prefer simply removing these attributes to only the root destination folder after completion of the robocopy command per Ricky's suggestion so that these attributes are respected for any sub-directories. Though the /A- switch is easier to manage and (for my backup purposes) are not relevant to any directories I am backing up. You may want to consider not removing the system or hidden attributes if you're backing up your C:\ drive though.
You could try this, I say could, because the whole Windows 10 has annoying flaws everywhere, I have lost trust to Windows 10 and Microsoft.
Well I found that after I robocopied the whole Documents-folder to a root of external drive, I got a folder that is not named Documents but the Documents-folder is renamed&translated to my native language, so it could be some Language issue. (the /XD option tells robocopy to skip a folder)
C:\users\asdf\documents >robocopy . f:\ManuBackup /XD c:\Users\Asdf\Documents\OneDrive /s
File Explorer shows Tiedostot-name (=Documents in finnish) and Command Prompt shows ManuBackup-name. Also I have tried all attrib.exe commands to the ManuBackup-folder, don't trust me 100%