Robocopy can't handle paths containing scandic characters - encoding

I am trying to copy folders with Robocopy from Windows 2008 server to Windows 2012 server.
Server language setting is english.
I use command like this:
robocopy "C:\Files\Folder with äö in name\Source" "D:\Folder with äö also" /MIR
Command fails like this:
Source : C:\Files\Folder with õ÷ in name\Source\
Dest : D:\Folder with õ÷ also\
...
ERROR 3 (0x00000003) Accessing Source Directory C:\Files\Folder with õ÷ in name\Source\
The system cannot find the path specified.
Bat-file that uses this command is created with Notepad. I have tried creating it with all encodings offered by notepad. None of them work, examples above come from ANSI encoding.
If I create test folders that don't contain foreign characters Robocopy works without erros.
How can Robocopy deal with Scandic characters?

Does it work with a normal directory?
I found that while the öä etc are not correctly logged in the log files robocopy processes them correctly.

Related

How to copy single file using robocopy?

I'm trying to copy a single file to the "Computer Backups" folder as shown below. The command does not work, even thought the syntax is correct, i.e., "source dest file". I've tried many permutations of this command, different quoting, and still it does not work. I've also tried running it using admin privs, to no avail. My guess is that it is a quoting issue.
robocopy F:\ "C:\Users\ben\OneDrive\Computer Backups" "HP Pavillion to USB_full_b2_s1_v1.tib"
-Thanks
Never mind, the problem was that OneDrive has a file size limit, and this file is 221 GB.

Robocopy: Copy file, and if an identical file name exists in destination, keep BOTH

I've got this line of code using Robocopy:
Robocopy C:\Autopilot_Export \\Zapp\pc\PLI\Hash_Exports Autopilot_CSV.csv
I will have multiple computers networked into this server running this same script and they'll be copying different CSVs under the same CSV name "Autopilot_CSV".
Is there a way to have Robocopy behave similarly to how Windows 10 does when you copy an identical file to a directory and hit "Keep Both" when prompted? So it would end up naming them Autopilot_CSV.csv, Autopilot_CSV(1).csv, Autopilot_CSV(2).csv, Autopilot_CSV(3).csv, and so on...
I've looked over the Robocopy documentation and found the /XN /XO /XE options, but they appear to all be referencing timestamps, differing sizes, older, and newer files. The timestamps and sizes of these files are going to all be different, however, the file names will be the same.
Is there a way to do this?
Thanks!

Robocopy not excluding changed files

I am copying a full directory over and am trying to exclude changed files. Note that I am doing this in Powershell.
robocopy "D:\Projects\Publishes\css" "D:\Projects\robocopy test\css" /xc
However my changed files at destination are being over-written. I can't use exclude older or newer files by the nature of my situation so these are out.
NOTE:
On the MSDN page it says /xct to exclude changed files but if I do this I get the following error:
ERROR : Invalid Parameter #3 : "/xct"
From other examples I've seen /xc so that is what I'm using here.
I translate your requirement as:
Some files on the destination directory have been changed. Don't replace those.
I think what you are looking for is the /XO flag
robocopy "D:\Projects\Publishes\css" "D:\Projects\robocopy test\css" /xo /e
This translates to
Do not overwrite newer files on the destination directory
Your /xn flag actually means
Do not copy newer files from the source directory
Sightly different.

How to copy folder (Via Command prompt) which is contain a space in the name?

if i copy without space (Name Folder),
example:
xcopy /E C:\Test\SQL G:\SQL
this copy all content of my folder, Fine!
i dont know how to copy folder if name contain a space, With "xcopy" command.
i found many reviews about space in command prompt and show me solutions like
c:\>xcopy /E "c:\Documents\SQL Server Management\" "G:\SQL\"
but doesn't work for me.
if I copy a folder where the name contains spaces, the result is: Invalid number of parameters...
Any can help me ?
Tnhks
You should report the error message you are receiving, what happened when you executed he command (if anything) and what you expected to happen.
Your problem is that copy requires a filemask to know which files you require to be copied.
c:>xcopy /E "c:\Documents\SQL Server Management*.*" "G:\SQL\"
specifies that all files with all extensions be copied. The quotes are required to specify "paths\containing spaces" as xcopy (or any other command has no way of reading your mind and can't be certain of what c:\Documents\SQL Server Management\ G:\SQL\ means - is it 'copy c:\Documents\SQL to "Server Management\ G:\SQL\"' or 'copy "c:\Documents\SQL Server" to "Management\ G:\SQL\"' or are sume of what appear to be arguments strays data or what?

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%