I have a client who I'm switching to SMB to connect to a network drive, but we have an issue with users not being able to see certain directories over SMB, but they can see it using AFP although, while using AFP they have major connectivity issues.

I found that the directories can't be seen in SMB because they have white spaces at the end for some reason, also some directories have illegal names so they contain characters like / and " which won't work in SMB.

I can do 'find . -name "[<>:\|?]*" ' to find files with illegal characters but how can I change it to do directories as well? Also, how can I also detect the white spaced folders?

I'm quite sure I'd have to use the find command but I'm a bit stumped on how to refactor it to do this.


You can try this: find . -d -name "* " -type d -exec bash -c 'TO=$(echo "{}" | sed "s/.$//"); FROM=$(echo "{}"); mv "${FROM}" "${TO}"' \;

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .