{"id":10514,"date":"2022-05-07T12:58:09","date_gmt":"2022-05-07T16:58:09","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=10514"},"modified":"2022-05-07T12:58:09","modified_gmt":"2022-05-07T16:58:09","slug":"renaming-files-with-dired","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=10514","title":{"rendered":"Renaming Files With Dired"},"content":{"rendered":"<p>I\u2019ve written about this many times before but it\u2019s so useful it bears repeating. It\u2019s about a technique I use all the time and one that I\u2019m sure the rest of you will find worthwhile too. This post is inspired by one from Alain Lafon, <a href=\"https:\/\/irreal.org\/blog\/?p=7159\">a master Emacs user<\/a>, about whom I\u2019ve written several times.<\/p>\n<p>The idea is simple. If you\u2019re an Emacs user and want to rename a file, the easiest way to do that is to use dired from within Emacs. <a href=\"https:\/\/200ok.ch\/posts\/edit-remote-files-with-emacs.html\">But what if you want to rename several, similarly named files?<\/a> The answer is the same except that you have to turn on wdired mode (<kbd>Ctrl<\/kbd>+<kbd>x<\/kbd> <kbd>Ctrl<\/kbd>+<kbd>q<\/kbd> by default). Once you\u2019ve entered wdired mode, the changes you make to the dired listing are reflected back to the actual files. So all you have to do is turn on wdired mode and use your favorite search replace method to change the target file names. Then you simply type <kbd>Ctrl<\/kbd>+<kbd>c<\/kbd> <kbd>Ctrl<\/kbd>+<kbd>c<\/kbd> to exit wdired mode and rename the files.<\/p>\n<p>Lafon\u2019s post has an animated GIF that demonstrates the process but the easiest way to see how it works is to try it out yourself. It really is a trick worth knowing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve written about this many times before but it\u2019s so useful it bears repeating. It\u2019s about a technique I use all the time and one that I\u2019m sure the rest of you will find worthwhile too. This post is inspired &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=10514\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-10514","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10514"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10514\/revisions"}],"predecessor-version":[{"id":10515,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10514\/revisions\/10515"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}