16 lines
847 B
Bash
Executable File
16 lines
847 B
Bash
Executable File
#!/bin/bash
|
|
# share_nfd.sh put|list|del — the NFC and the NFD form of one name on the „Filmek" share (SMB), as a Windows PC and a Mac would send them
|
|
cd /root/data/nextcloud/Csalad/Kulonleges_nevek || exit 1
|
|
smb() { smbclient //felhom.tester4.test/Filmek -U felhom --password="$PW" -m SMB3 -c "$1" 2>&1 | grep -v "^Try\|^$"; }
|
|
case $1 in
|
|
put) for f in *lista.txt; do smb "mkdir Nevek; cd Nevek; put \"$f\" \"$f\"" | tail -1; done ;;
|
|
del) for f in *lista.txt; do smb "cd Nevek; del \"$f\""; done; echo deleted ;;
|
|
esac
|
|
smb "cd Nevek; ls" | grep -v "blocks of size" | python3 -c "
|
|
import sys,unicodedata
|
|
for l in sys.stdin:
|
|
n=l.strip().rsplit(' ',1)[0].strip()
|
|
if n in ('.','..') or not n: continue
|
|
nm=n.split(' ')[0].strip(); f='NFC' if nm==unicodedata.normalize('NFC',nm) else 'NFD'
|
|
print(' ',f,len(nm.encode()),'bytes:',nm)"
|