{"id":2605,"date":"2025-12-21T17:21:52","date_gmt":"2025-12-21T16:21:52","guid":{"rendered":"https:\/\/labalec.fr\/erwan\/?p=2605"},"modified":"2025-12-24T18:52:27","modified_gmt":"2025-12-24T17:52:27","slug":"rclone-and-encrypted-or-obfucasted-filenames","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=2605","title":{"rendered":"Rclone and encrypted or obfucasted filenames"},"content":{"rendered":"\n<p>In previous article, i have explained how to rclone one local folder to a remote folder.<\/p>\n\n\n\n<p>While doing so i had enable filename encryption.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Here below a dry run script (to test safely) and a real run script &#8211; all this from the synology command line.<\/p>\n\n\n\n<p>Note that we need to suffix files with .bin or else rclone will not recognize the files as encrypted.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nREMOTE_CRYPT=\"ovhcrypt:\"\nREMOTE_RAW=\"ovhftp:\/backup\/\"\n\necho \"=== DRY RUN (DECRYPT NAMES + ADD .BIN) ===\"\n\nrclone lsf -R \"$REMOTE_RAW\" | while read -r path; do\n\n    # Ignore les dossiers\n    &#91;&#91; \"$path\" == *\/ ]] &amp;&amp; continue\n\n    # S\u00e9pare dossier et fichier\n    dir=\"${path%\/*}\"\n    filename=\"${path##*\/}\"\n\n    # Filtre : noms chiffr\u00e9s rclone (base32, &gt;=16 chars)\n    if ! &#91;&#91; \"$filename\" =~ ^&#91;a-z0-9]{16,}$ ]]; then\n        echo \"Skip (not encrypted): $path\"\n        continue\n    fi\n\n    # D\u00e9crypte uniquement le nom du fichier\n    decfile=$(rclone cryptdecode \"$REMOTE_CRYPT\" \"$filename\" 2&gt;\/dev\/null | awk '{print $NF}')\n\n    if &#91;&#91; -z \"$decfile\" ]]; then\n        echo \"Skip (cryptdecode failed): $path\"\n        continue\n    fi\n\n    # Ajoute l'extension .bin\n    decfile_bin=\"${decfile}.bin\"\n\n    # Reconstruit le chemin final\n    if &#91;&#91; \"$dir\" == \"$path\" ]]; then\n        decpath=\"$decfile_bin\"\n    else\n        decpath=\"$dir\/$decfile_bin\"\n    fi\n\n    echo \"DRY RUN: Would rename: $path  --&gt;  $decpath\"\n\ndone\n\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nREMOTE_CRYPT=\"ovhcrypt:\"\nREMOTE_RAW=\"ovhftp:\/backup\/\"\n\necho \"=== REAL RUN (DECRYPT NAMES + ADD .BIN) ===\"\n\nrclone lsf -R \"$REMOTE_RAW\" | while read -r path; do\n\n    # Ignore les dossiers\n    &#91;&#91; \"$path\" == *\/ ]] &amp;&amp; continue\n\n    # S\u00e9pare dossier et fichier\n    dir=\"${path%\/*}\"\n    filename=\"${path##*\/}\"\n\n    # Filtre : noms chiffr\u00e9s rclone (base32, &gt;=16 chars)\n    if ! &#91;&#91; \"$filename\" =~ ^&#91;a-z0-9]{16,}$ ]]; then\n        echo \"Skip (not encrypted): $path\"\n        continue\n    fi\n\n    # D\u00e9crypte uniquement le nom du fichier\n    decfile=$(rclone cryptdecode \"$REMOTE_CRYPT\" \"$filename\" 2&gt;\/dev\/null | awk '{print $NF}')\n\n    if &#91;&#91; -z \"$decfile\" ]]; then\n        echo \"Skip (cryptdecode failed): $path\"\n        continue\n    fi\n\n    # Ajoute l'extension .bin pour compatibilit\u00e9 ovhcrypt2\n    decfile_bin=\"${decfile}.bin\"\n\n    # Reconstruit le chemin final\n    if &#91;&#91; \"$dir\" == \"$path\" ]]; then\n        decpath=\"$decfile_bin\"\n    else\n        decpath=\"$dir\/$decfile_bin\"\n    fi\n\n    echo \"Renaming: $path  --&gt;  $decpath\"\n\n    # Renommage optimis\u00e9 et OVH-friendly\n    rclone moveto \"$REMOTE_RAW$path\" \"$REMOTE_RAW$decpath\" \\\n        --transfers 1 \\\n        --checkers 1 \\\n        --multi-thread-streams 0 \\\n        --ftp-concurrency 1 \\\n        --low-level-retries 3 \\\n        --retries 3 \\\n        --stats 10s\n\n    # Petite pause pour \u00e9viter les 421\n    sleep 0.2\n\ndone\n\n<\/code><\/pre>\n\n\n\n<p>Note, once all crypted filenames have been renamed to non encrypted filenames (with .bin extension), i stopped using ovhcrypt remote and switched to ovhcrypt2 remote.<\/p>\n\n\n\n<p>my command is rclone sync \/volume1\/photo ovhcrypt2: &#8211;progress .<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ovhcrypt]\ntype = crypt\nremote = ovhftp:\/backup\ndirectory_name_encryption = false\npassword = xxx\npassword2 = xxx\n\n&#91;ovhftp]\ntype = ftp\nhost = ftp.xxx.fr\nuser = username\npass = password\n\n&#91;ovhcrypt2]\ntype = crypt\nremote = ovhftp:\/backup\nfilename_encryption = off\ndirectory_name_encryption = false\npassword = xxx\npassword2 = xxx\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 <a href='https:\/\/labalec.fr\/erwan\/?p=2605' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[147],"tags":[],"class_list":["post-2605","post","type-post","status-publish","format-standard","hentry","category-rclone","category-147-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2605"}],"version-history":[{"count":7,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2605\/revisions"}],"predecessor-version":[{"id":2615,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2605\/revisions\/2615"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}