Normalize unicode file names (converts UTF-8 NFD to NFC).
Required by macOS clients through AFP/NFS/SMB.
Tested on Synology DSM 6.2 with built-in Python 2.7.12.
# 1. Activate SSH on your NAS
# 2. On your computer, open a new console/terminal and connect to your server:
ssh [email protected]
# 3. Go to the directory where you want saving the `nfcfn.py` script:
cd /volume1/YourSharedFolder/PathToScript
# 4. Download the latest version:
wget https://gist.githubusercontent.com/xthezealot/9a65fac2c7b916c4d84e66188bf06bec/raw/nfcfn.py
# 5. Run it with Python to check the result:
python nfcfn.py -cr /volume1/YourSharedFolder
# 6. When you are sure, add the `-p` flag to effectively rename the files:
python nfcfn.py -crp /volume1/YourSharedFolder
I have found out why. There was fullwidth slash (/) in the original filename. It was converted to normal slash (/) by nfcfn.py and the new slash was interpreted as a path separator. I have global replaced those characters with a division slash (∕) and the script has completed successfully. I think they are better be handled by the script itself.
There is another problematic character fullwidth backslash(\) which should be replaced as small reverse slash(﹨) as well.
These fullwidth characters are very common in the Asian languages and file names.