Déc 212025
In previous article, i have explained how to rclone one local folder to a remote folder.
While doing so i had enable filename encryption.
It appears that it brings nothing but complexity (content encryption is all that matters to me) and i now want to revert to original filenames while not having to reupload it all.
Here below a dry run script (to test safely) and a real run script – all this from the synology command line.
#!/bin/bash
REMOTE_CRYPT="ovhcrypt:"
REMOTE_RAW="ovhftp:/backup/"
echo "=== DRY RUN (CORRECTED VERSION) ==="
rclone lsf -R "$REMOTE_RAW" | while read -r path; do
# Ignore les dossiers
[[ "$path" == */ ]] && continue
# Sépare dossier et fichier
dir="${path%/*}"
filename="${path##*/}"
# Filtre : noms chiffrés rclone
if ! [[ "$filename" =~ ^[a-z0-9]{16,}$ ]]; then
echo "Skip (not encrypted): $path"
continue
fi
# Décrypte uniquement le nom du fichier
decfile=$(rclone cryptdecode "$REMOTE_CRYPT" "$filename" 2>/dev/null | awk '{print $NF}')
if [[ -z "$decfile" ]]; then
echo "Skip (cryptdecode failed): $path"
continue
fi
# Reconstruit le chemin final
if [[ "$dir" == "$path" ]]; then
# fichier à la racine
decpath="$decfile"
else
decpath="$dir/$decfile"
fi
echo "Would rename: $path --> $decpath"
done
#!/bin/bash
REMOTE_CRYPT="ovhcrypt:"
REMOTE_RAW="ovhftp:/backup/"
echo "=== REAL RUN (OPTIMIZED + OVH-FRIENDLY) ==="
rclone lsf -R "$REMOTE_RAW" | while read -r path; do
# Ignore les dossiers
[[ "$path" == */ ]] && continue
# Sépare dossier et fichier
dir="${path%/*}"
filename="${path##*/}"
# Filtre : noms chiffrés rclone (base32, >=16 chars)
if ! [[ "$filename" =~ ^[a-z0-9]{16,}$ ]]; then
echo "Skip (not encrypted): $path"
continue
fi
# Décrypte uniquement le nom du fichier
decfile=$(rclone cryptdecode "$REMOTE_CRYPT" "$filename" 2>/dev/null | awk '{print $NF}')
if [[ -z "$decfile" ]]; then
echo "Skip (cryptdecode failed): $path"
continue
fi
# Reconstruit le chemin final
if [[ "$dir" == "$path" ]]; then
decpath="$decfile"
else
decpath="$dir/$decfile"
fi
echo "Renaming: $path --> $decpath"
# Renommage optimisé et OVH-friendly
rclone moveto "$REMOTE_RAW$path" "$REMOTE_RAW$decpath" \
--transfers 1 \
--checkers 1 \
--multi-thread-streams 0 \
--ftp-concurrency 1 \
--low-level-retries 3 \
--retries 3 \
--stats 10s
# Petite pause pour éviter les 421
sleep 0.2
done