One thing I regularly come across in system’s administration is the handy Mac user that has somehow managed to a white space on the end of a file or folder on the Windows CIFS/SMB share. Windows doesn’t tend to care about it too much until you go to move/rename/delete it and then it throws its toys out of it’s pram.
The way to remove these files is to use the namespace at an elevated command prompt, don’t even bother trying to use the GUI.
We’ll say there is a fictitious share on the E:\ of the server in DATA and halfway down a tree there is a badly named folder. E:\Company\data\folder\I love data \files_woohoo.txt. To delete this you would think you could just delete “I love data ” but Windows will throw the error “The system cannot find the file specified.”
rmdir "E:\Company\data\folder\I love data \" /s
The system cannot find the file specified.
Well that sucks. Let’s go with namespace instead:
rmdir "\\?\E:\Company\data\folder\I love data " /s
Meep meep! Removed. I hate Windows filesystem when Macs talk to them.