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 am not familiar with python. Sorry that I did not read your code.
After reading your code, I now understand that I can avoid the problem by not adding -c option to the argument now.
The compatible version, NFKA normalization, may introduce invalid characters. I think NFC normalization is a better option for file name conversion.
There should be at least 3 characters that are commonly used in Asian languages will become problematic after converted to NFKC form. They are:
/
\
:
I would recommend omitting option
-c
from the arguments to avoid possible problems.