{"id":25723,"date":"2007-08-03T10:00:00","date_gmt":"2007-08-03T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/08\/03\/it-was-not-one-of-explorers-design-goals-to-provide-a-turing-complete-interface-for-bulk-file-renaming\/"},"modified":"2007-08-03T10:00:00","modified_gmt":"2007-08-03T10:00:00","slug":"it-was-not-one-of-explorers-design-goals-to-provide-a-turing-complete-interface-for-bulk-file-renaming","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070803-00\/?p=25723","title":{"rendered":"It was not one of Explorer&#039;s design goals to provide a Turing-complete interface for bulk file renaming"},"content":{"rendered":"<p>\nSomebody wanted to append an extension to all files in a directory\nand couldn&#8217;t find a way to do this type of bulk rename in Explorer.\nOn the other hand, it&#8217;s pretty simple from the command prompt:\n<\/p>\n<pre>\nren * *.ext\n<\/pre>\n<p>\nThe person then asked,\n&#8220;Can we get this and other multi-file operations added to Explorer?&#8221;\n<\/p>\n<ul>\n<li>\n&#8220;There should be a way to rename a large number of files,\nappending .ext to the name of each file\n(for example changing x to x.ext).&#8221;<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/12\/05\/1211409.aspx#1212132\">\nchanging ABC to XYZ in each name<\/a>\n(for example changing Customer_ABC_History.doc to Customer_XYZ_History.doc).&#8221;<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\nswapping the first two words in each file name\n(for example changing Bob Smith.vcf to Smith, Bob.vcf).&#8221;<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\nnaming each file after the date and time it was created\n(for example IMG_2150.JPG becomes Photo December 25, 2004 0735am.JPG).&#8221;<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\ninserting the word (Provisional)\nafter the first word\n(for example changing Recommendations for Smith account.doc\nto Recommendations (Provisional) for Smith account.doc.)&#8221;<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\n<a HREF=\"http:\/\/blogs.msdn.com\/michkap\/archive\/2006\/05\/28\/608979.aspx\">\nchanging the case of each file name<\/a>\n(for example changing Recommendations for Smith account.doc\nto Recommendations For Smith Account.doc.)&#8221;\n(Note that the above case change is incorrect, but computers don&#8217;t know that.)<\/p>\n<li>\n&#8220;There should be a way to rename a large number of files,\ninserting the name of the album extracted from the mp3 metadata\nbefore the title\n(for example changing\n<a>Tick Tock<\/a>.mp3 to\nBeautiful Ride &#8211; Tick Tock.mp3.)&#8221;\n<\/ul>\n<p>\nIt was not one of Explorer&#8217;s design goals\nto provide a Turing-complete interface for bulk file renaming.\n(Remember,\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/03\/21\/1922203.aspx\">\nyou don&#8217;t know what you do until you know what you don&#8217;t do<\/a>.)\n<\/p>\n<p>\nExplorer does an extremely simple type of bulk rename:\nRenumbering a group of files.\nIf that doesn&#8217;t suit your needs, you can use the command prompt.\n<\/p>\n<pre>\nren * *.ext\n<\/pre>\n<p>\nOr you can write a batch file that does some editing before\ndoing the rename.\n<\/p>\n<pre>\nfor %%i in (*.doc) do call :fancy %%i\ngoto :eof\n:fancy\nset _=%1\nren %_% %_:ABC=XYZ%\n<\/pre>\n<p>\nYou can generate a list of files to rename and then load it\ninto your favorite editor to turn it into a batch file to execute.<\/p>\n<p><pre>\ndir \/b *.vcf &gt; files.cmd\nvi files.cmd\n:%s\/^\\([^ ]*\\) \\([^ ]*\\)\\(.*\\)\/ren \"\\1 \\2\\3\" \"\\2 \\1\\3\"\nZZ\nfiles\n<\/pre>\n<p>\nOr you can write a program in your favorite language that does the\nmost awesome-fancy renaming the world has ever seen.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Somebody wanted to append an extension to all files in a directory and couldn&#8217;t find a way to do this type of bulk rename in Explorer. On the other hand, it&#8217;s pretty simple from the command prompt: ren * *.ext The person then asked, &#8220;Can we get this and other multi-file operations added to Explorer?&#8221; [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-25723","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Somebody wanted to append an extension to all files in a directory and couldn&#8217;t find a way to do this type of bulk rename in Explorer. On the other hand, it&#8217;s pretty simple from the command prompt: ren * *.ext The person then asked, &#8220;Can we get this and other multi-file operations added to Explorer?&#8221; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=25723"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25723\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=25723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=25723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=25723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}