I've found a bad habit file naming among the users of the QNAP Linux NAS system I'm administering. We have a Mac OS network, and some folders and files are named using the "/" character that I know it's causing problems to Linux file system. As a matter of fact, from the Mac OS side, the files containing "/" simply disappear, since QTS replaces automatically all instances with "/" with ":".
I'd like to search and rename filenames from ":" to "_".
Discussing on the web I've found that I can SSH connect to the Linux NAS from my Mac with Terminal and perform a script like this:
for f in $(find /share/Public/demofind -name "*:*"); do mv $f ${f/:/_}; done
assuming that the files are in /demofind folder.
I launched the script, but got this error:
[/share/Public] # for f in $(find /share/Public/demofind/ -name "*:*"); do mv $f ${f/:/_}; done
mv: unable to rename `/share/Public/demofind/Redazionali': No such file or directory
mv: unable to rename `01:03:19.pdf': No such file or directory
mv: unable to rename `/share/Public/demofind/Redazionali': No such file or directory
mv: unable to rename `06:09:19.pdf': No such file or directory
[/share/Public] # for f in $(find /share/Public/demofind/ -name "*:*"); do mv $f ${f/:/_}; done
mv: unable to rename `/share/Public/demofind/Redazionali': No such file or directory
mv: unable to rename `01:03:19.pdf': No such file or directory
mv: unable to rename `/share/Public/demofind/Redazionali': No such file or directory
mv: unable to rename `06:09:19.pdf': No such file or directory
By the way, the files to rename have a syntax like this: "Redazionali 06:09:19.pdf"
The NAS seems to be running BusyBox v1.01 (2021.12.12-04:24+0000) so I would need a solution which is compatible with this platform.