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
Simply because with some fonts, different strings may look exactly the same although they are in fact not "equal".
So for example, if you have a file that contains
fi
(1 char) in its name, and you search forfi
(2 chars), you may not find this file.And different versions of a same OS can have a different behaviors.
If you're not aware of this kind of subtlety, it can be tricky. It's not always as obvious as
³
vs.3
.That's why I recommend sticking as close as possible to ASCII characters for file names.
Even spaces in a file path can cause problems with some apps, I experienced it, but that's too much of a rule…
So yes, it's an old-school recommendation but still a "good practice" when heterogenous OS and file systems share the same data, which is the purpose of a NAS.
But if only you have access to your NAS and always through the same device, OK, the
-c
option is not a big win.