Robocopy "ERROR 123 (0x0000007B) Accessing Source Directory xxx The filename, directory name, or volume label syntax is incorrect." - robocopy

I'm using robocopy on a Windows10 computer without any problem.
I copied my bat file to a windows11 computer and can't make it run because of this error:
C:\Users\didie.spyder-py3>robocopy ÔǬ"C:\Users\didie.spyder-py3" "C:\Users\didie\ShadowDrive\Sauvegarde-.spyder-py3" /E /S /Z /FFT /NP /NDL /NS /NFL /NC /MT:8
2022/09/05 15:04:15 ERREUR 123 (0x0000007B) Accès au répertoire source C:\Users\didie.spyder-py3\ÔǬC:\Users\didie.spyder-py3
La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.
i.e. ERROR 123 (0x0000007B) Accessing Destination Directory ...
The filename, directory name, or volume label syntax is incorrect.
Here is my one-line bat file:
echo "start"
robocopy ‪"C:\Users\didie\.spyder-py3" "C:\Users\didie\ShadowDrive\Sauvegarde-.spyder-py3" /E /S /Z /FFT /NP /NDL /NS /NFL /NC /MT:8
:: robocopy ‪C:"\Users\didie\.spyder-py3" D:"\Sauvegardes\Sauvegarde-.spyder-py3" /E /S /Z /FFT /NP /NDL /NS /NFL /NC /MT:8
pause
If anybody knows the trick to make it work...

Related

robocopy is giving unequal number of directories but same number of files?

When running robocopy I am experiencing the following. Can you correct/explain what is happening, please?
I get an extra directory under the total column and 1 skipped directory. Yet the number of files in total and copied columns are the same?. Note the number of bytes is also the same.
One of my directories appears to copy all but hangs up in some kind of a loop necessitating a restart of robocopy. I am never confident that the copy is ok. How can I identify the problem?
Options listed in the log are different than those specified.
robocopy "E:\mmarion.4" "D:\mmarion.4" /E /256 /NC /NFL /NS /NDL /NP /TEE
becomes
Options : *.* /256 /NS /NC /NDL /NFL /TEE /S /E /DCOPY:DA /COPY:DAT /NP /R:1000000 /W:30
Thank you. MM
For part 3: Even if you don't specify some options, the output tells you which options are getting applied. In the case you quoted, the following are defaults, so they appear in the output even though you didn't include them in your command.
/DCOPY:DA
/COPY:DAT
/R:1000000
/W:30
The other odd one is /S. You specified /E, and Robocopy reports both /E and /S when you do that. That's technically a bit misleading, because /S means "... but not empty ones", and /E means "... including empty ones", so it can't really be both at the same time. But if you think of /S as meaning "... non-empty subdirectories" and /E meaning "... both empty and non-empty subdirectories", then having /E expanded to both /S and /E is not unreasonable.

Traverse samba shares during robocopy and exclude some

I use Robocopy for backup Samba shares into local drive and vice versa.
To sync remote share with local folder I use PS script
$Path = Split-Path "\\192.168.1.100\asuscloud\*"
$Dest = "E:\back_fold\asuscloud\"
robocopy $Path $Dest /B /MT:64 /IS /Z /FP /MIR /TEE /NP /FP /NDL
To exclude some subfolder one can use /XD switch
$Path = Split-Path "\\192.168.1.100\asuscloud\*"
$Dest = "E:\back_fold\asuscloud"
robocopy $Path $Dest /B /MT:64 /IS /Z /FP /MIR /TEE /NP /FP /NDL /XD "\\192.168.1.100\asuscloud\subdir"
However, this syntax doesn't work for the host and shares of this host
$Path = Split-Path "\\192.168.1.100\*"
$Dest = "E:\back_fold\"
robocopy $Path $Dest /B /MT:64 /IS /Z /FP /MIR /TEE /NP /FP /NDL /XD "\\192.168.1.100\asuscloud\"
It throws
------------------------------------------------------------------------------>-
ROBOCOPY :: Robust File Copy for Windows
Started : Saturday, September 1, 2018 8:46:23 PM
Source : D:\back_fold\
Dest -
Files : .
Exc Dirs : \192.168.1.100\asuscloud
Options : . /FP /NDL /TEE /DCOPY:DA /COPY:DAT /Z /NP /IS /MT:64 /R:1000000 /W:30
ERROR : No Destination Directory Specified.
I want to exclude two shares of a host and sync others into local folder.
How to achieve this?
UPDATE: nbtstat -A 192.168.1.100
C:\Windows\system32>nbtstat -A 192.168.1.100
Ethernet:
Node IpAddress: [0.0.0.0] Scope Id: []
Host not found.
Ethernet 2:
Node IpAddress: [0.0.0.0] Scope Id: []
Host not found.
Bluetooth Network Connection:
Node IpAddress: [0.0.0.0] Scope Id: []
Host not found.
Wi-Fi:
Node IpAddress: [192.168.1.105] Scope Id: []
NetBIOS Remote Machine Name Table
Name Type Status
---------------------------------------------
PASCAL <00> UNIQUE Registered
PASCAL <03> UNIQUE Registered
PASCAL <20> UNIQUE Registered
☺☻__MSBROWSE__☻<01> GROUP Registered
WORKGROUP <1E> GROUP Registered
WORKGROUP <00> GROUP Registered
WORKGROUP <1D> UNIQUE Registered
WORKGROUP <1B> UNIQUE Registered
MAC Address = 00-00-00-00-00-00
Local Area Connection* 3:
Node IpAddress: [0.0.0.0] Scope Id: []
Host not found.
NET VIEW \\192.168.1.100
C:\Windows\system32>NET VIEW \\192.168.1.100
Shared resources at \\192.168.1.100
Pascal
Share name Type Used as Comment
-------------------------------------------------------------------------------
asuscloud Disk data's asuscloud in External USB3.0
backup Disk data's backup in External USB3.0
downloads Disk data's downloads in External USB3.0
dropbox Disk data's dropbox in External USB3.0
entware Disk data's entware in External USB3.0
os Disk data's os in External USB3.0
The command completed successfully.
This does not dynamically find the shares on the remote host, but it does allow you to specify the SHARENAMEs from which to copy.
I think your basic misunderstanding is that a hostname (or IP address) alone is not a path. It has to also have a SHARENAME.
If you save this as Do-It.ps1, then to see the verbose messages, invoke it with .\Do-It.ps1 -Verbose
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, position=0)]
[string]$computername
,[Parameter(Mandatory=$true, position=1)]
[string[]]$sharenames
,[Parameter(Mandatory=$false, position=2)]
[string]$dest = 'E:/back_fold/asuscloud'
)
$excludeshares = #('SHARE1', 'OTHERSHARE')
foreach ($sharename in $sharenames) {
write-Verbose $sharename
if ($excludeshares -notcontains $sharename.ToUpper()) {
$Path = "//$computername/$sharename"
$cmdline = { robocopy $Path $Dest /B /MT:64 /IS /Z /FP /MIR /TEE /NP /FP /NDL }
Write-Verbose $cmdline.ToString()
& $cmdline
}
}
This can be use with a file containing a list of SHARENAMEs.
.\Do-It.ps1 -computername '192.168.1.100' -sharenames $(Get-Content -Path .\sharelist.txt)
remember \ is an escape character. Two \ equals 1 . Try using single quotes ' on your variable strings instead of double quotes "
That's why it's looking for \192.168.1.100\ instead of \192.168.1.100\
I'd also include share names if needed.
Single quotes will allow you to not need to escape. Example:
$Path = Split-Path '\\192.168.1.100\asuscloud\*'
$Dest = 'E:\back_fold\asuscloud\'
Using double quotes might need escaping. Example:
$Path = Split-Path "\\\\192.168.1.100\\asuscloud\\*"
$Dest = "E:\\back_fold\\asuscloud\\"
Please note you might need to escape the asterisk as well.
Including sharename (if needed). Example:
$Path = Split-Path '\\192.168.1.100\c$\asuscloud\*'

Robocopy: echo nothing when logging file

I am using Robocopy to write to log files:
robocopy "C:\source" "E:\destination" /e /l /njs /njh /log:C:\folder1\reconcile1.txt
When I use this in my batch file the console shows: Log File : C:\folder1\reconsile1.txt
I do no want anything echoed from this command. Is there a way to keep this away from appearing on the console?
You could redirect all output to nul:
robocopy "C:\source" "E:\destination" /e /l /njs /njh /log:C:\folder1\reconcile1.txt > nul

Robocopy logfile (not showing missed/failed files)

I'm having trouble getting this to work properly, I'm trying to copy every file from an external HDD to my NAS device, and i only wanted to see in the logfile what are the files that have been skipped or not copied, this is what i used after reading on the forums:
Robocopy E:\ "\\NAS" /e /v /nfl /ndl /njh /njs /ns /nc /np /log+:"C:\Users\xx\Desktop\log.txt"
For some reason, it doesn't save anything to the logfile when it's done, completely empty. Yet when i check the file and folder properties of both HDD and the Backup folder it shows that there are over 50,000 files that have NOT been copied.

Robocopy Only Output Copied Files

I have the following Robocopy command. Currently it outputs all directories it is traversing during the mirror but I only want it to output what actually got synced from source to destination. I'm not seeing a "only show differences" option in the documentation.
robocopy "C:\inetpub\example.com" "Z:\D Drive\Projects\example.com\Web\example.Web" /mir /xd "C:\inetpub\example.com\wp-content\mu-plugins\example-network" "C:\inetpub\example.com\wp-
content\plugins\example" "C:\inetpub\example.com\wp-content\themes\example" ".git"
Of course I figured it out right after I posted the question. Here is my new command. The /fp /ns /ndl options did the trick.
robocopy "C:\inetpub\example.com" "Z:\D Drive\Projects\example.com\Web\example.Web" /mir /fp /ns /ndl /xd "C:\inetpub\example.com\wp-content\mu-plugins\example-network" "C:\inetpub\example.com\wp-content\plugins\example" "C:\inetpub\example.com\wp-content\themes\example" ".git"
Meaning of switches
From SS64 entry:
/FP : Include Full Pathname of files in the output.
[...]
/NS : No Size - don’t log file sizes.
[...]
/NDL : No Directory List - don’t log directory names.