robocopy to NAS affecting target directory such that it is Hidden on macOS
Have a WIndows 10 and a MacOS Monterey 12.6 system connected through an ethernet switch to a Synology DSM7 NAS box. I'm using robocopy in a .cmd script that I schedule nightly to backup windows volumes (other than C:) to the NAS. I can see the files are being backuped up OK looking on the NAS.The directory on the NAS is like:
\NetBackup\Intel1\Volumes\D (in the case of my D volume on Intel1)
On the Mac, I have the share mounted and the path to the directory there is:
/Volumes/NetBackup/Intel1/Volumes/
I can show hidden files in this directory in Finder and I see that directory D is there, but it is hidden. The files under /Volumes/NetBackup/Intel1/Volumes/D are not hidden. In the Mac terminal, I can
ls -laO /Volumes/NetBackup/Intel1/Volumes
And I can see the 'hidden' flag is set on the D directory. I can issue
chflags nohidden /Volumes/NetBackup/Intel1/Volumes/D
and it resets the hidden flag and the directory is visible as a normal directory in Finder. However, if I re-run the script with robocopy again, the D directory is hidden again. The robocopy command is:
robocopy D:\ \NAS1\NetBackup\Intel1\Volumes\D /xd --exclude-dirs-- /xf --exclude-files-- /log+:--log-file-- /mir /fft /np /dcopy:DAT /r:5 /w:5 /mt:32
Why would the robocopy command affect the target directory's hidden flag and is there a way to prevent that?