{"id":3413,"date":"2026-05-01T10:49:41","date_gmt":"2026-05-01T08:49:41","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3413"},"modified":"2026-05-01T11:29:59","modified_gmt":"2026-05-01T09:29:59","slug":"modify-several-symlinks-at-once","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3413","title":{"rendered":"Modify several symlinks at once"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">adding  <code>..\/<\/code> to the target path<\/h4>\n\n\n\n<p>If you have to add the same property, i.g. <code>..\/<\/code> to several symlinks in the same folder, you can use this code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nfor f in *; do \n  &#91; -L \"$f\" ] || continue\n  &#91; -e \"$f\" ] &amp;&amp; continue   # skip the valid ones\n\n  target=$(readlink \"$f\")\n  &#91;&#91; \"$target\" != \/* ]] &amp;&amp; ln -snf ..\/\"$target\" \"$f\"\ndone<\/code><\/pre>\n\n\n\n<p>You can either save this code in a bash file, or paste it directly in a terminal.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">another case: replace the name of the target file<\/h4>\n\n\n\n<p>If you have now target files renamed with &#8220;-&#8221; instead of space &#8221; &#8220;, you can use this code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for f in *; do\n  &#91; -L \"$f\" ] || continue\n  &#91; -e \"$f\" ] &amp;&amp; continue\n\n  target=$(readlink \"$f\")\n  newtarget=${target\/\/ \/-}\n\n  &#91;&#91; \"$target\" != \"$newtarget\" ]] &amp;&amp; ln -snf \"$newtarget\" \"$f\"\ndone<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>adding ..\/ to the target path If you have to add the same property, i.g. ..\/ to several symlinks in the same folder, you can use this code: You can either save this code in a bash file, or paste it directly in a terminal. another case: replace the name of the target file If &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=3413\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;Modify several symlinks at once&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[647,573],"tags":[62],"class_list":["post-3413","post","type-post","status-publish","format-standard","hentry","category-linux","category-sistema-operativo","tag-symlinks"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3413"}],"version-history":[{"count":7,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3413\/revisions"}],"predecessor-version":[{"id":3422,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3413\/revisions\/3422"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}