{"id":1083,"date":"2026-08-25T22:30:38","date_gmt":"2026-08-25T20:30:38","guid":{"rendered":"https:\/\/jakobsens.net\/?p=1083"},"modified":"2026-08-25T22:34:03","modified_gmt":"2026-08-25T20:34:03","slug":"rename-extension-of-many-files-at-once","status":"publish","type":"post","link":"https:\/\/jakobsens.net\/?p=1083","title":{"rendered":"Rename extension of many files at once on Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You can do this easily with Bash parameter substitution.<br><br><strong>Single directory:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, I recommend a <strong>dry run<\/strong> so you can see what will happen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>for f in *.de.da.srt; do\n    echo mv -- \"$f\" \"${f\/.de.da.srt\/.da.srt}\"\ndone<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>movie.de.da.srt  -> movie.da.srt\nepisode01.de.da.srt -> episode01.da.srt<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the output looks correct, remove <code>echo<\/code>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>for f in *.srt.de.srt; do<br>    mv -- \"$f\" \"${f\/.de.da.srt\/.da.srt}\"<br>done<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Including subdirectories:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have files recursively in many directories, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>find . -type f -name '*.de.da.srt' -print0 |\nwhile IFS= read -r -d '' f; do\n    mv -- \"$f\" \"${f%.de.da.srt}.da.srt\"\ndone<\/code><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can do this easily with Bash parameter substitution. Single directory: First, I recommend a dry run so you can see what will happen: For example: If the output looks correct, remove echo: for f in *.srt.de.srt; do mv &#8212; &#8220;$f&#8221; &#8220;${f\/.de.da.srt\/.da.srt}&#8221;done Including subdirectories: If you have files recursively in many directories, use:<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1083","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/1083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1083"}],"version-history":[{"count":3,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/1083\/revisions"}],"predecessor-version":[{"id":1086,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/1083\/revisions\/1086"}],"wp:attachment":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}