{"id":9726,"date":"2005-12-01T20:37:45","date_gmt":"2005-12-01T17:37:45","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/2005\/12\/01\/lowercasing-filenames-from-the-linux-command-line\/"},"modified":"2005-12-01T20:37:45","modified_gmt":"2005-12-01T17:37:45","slug":"lowercasing-filenames-from-the-linux-command-line","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2005\/12\/01\/lowercasing-filenames-from-the-linux-command-line\/","title":{"rendered":"Lowercasing filenames from the Linux command line"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>I don&#8217;t remember if I posted this little snippet of shell code, so I&#8217;ll risk it for the dup.<\/p>\n<p>If you got yourself a messy directory with files &#8211; say, all filenames have a mixed case &#8211; you can put order in it pretty easy.  The example below lowercases filenames of all Jpeg files (JPG and JPEG extensions) in the current directory.<\/p>\n<pre>\r\nfor FILE in *.JP*G\r\ndo\r\n  mv \"$FILE\" `echo \"$FILE\" | tr A-Z a-z`\r\ndone\r\n<\/pre>\n<p>The algorithm is very simple.  For each file in the current directory that has an extension of JPEG or JPG (actually with any symbol between JP and G) execute a <code>mv<\/code> command.  <code>mv<\/code> requires two arguments &#8211; the source filename and the destination.  For the source argument we provide it with the name of the currently processed file.  The destination filename we find out by filtering the name of the currently processed file through the <code>tr A-Z a-z<\/code> command.<\/p>\n<p>What does the <code>tr A-Z a-z<\/code> command do?  It simply substitutes latters in one range from appropriate letters in another range.  The first range in this example includes all uppercase letters (A-Z), while the second range includes all lowercase letters (a-z).<\/p>\n<p>That&#8217;s all folks&#8230;<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>I don&#8217;t remember if I posted this little snippet of shell code, so I&#8217;ll risk it for the dup. If you got yourself a messy directory with files &#8211; say, all filenames have a mixed case &#8211; you can put order in it pretty easy. The example below lowercases filenames of all Jpeg files (JPG &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2005\/12\/01\/lowercasing-filenames-from-the-linux-command-line\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lowercasing filenames from the Linux command line<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"keyring_services":[],"class_list":["post-9726","post","type-post","status-publish","format-standard","hentry","category-general"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":7364,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/resizing-or-rotating-a-banch-of-images\/","url_meta":{"origin":9726,"position":0},"title":"Resizing or rotating a banch of images","author":"Leonid Mamchenkov","date":"March 23, 2004","format":false,"excerpt":"It is very often that one has a need to rotate a bunch of images by 90 or 180 degrees clockwise or otherwise, or resize the same bunch of images to a certain size. Read more to learn how you can do it. First of all, you should defenetely install\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7365,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/temporary-backup-of-a-few-files\/","url_meta":{"origin":9726,"position":1},"title":"Temporary backup of a few files","author":"Leonid Mamchenkov","date":"March 23, 2004","format":false,"excerpt":"Now, calm down, we are not talking about tar(1) or cpio(1) backups. Sometimes, there is a need to make a temporary copy of a few files and then copy them back to original filenames. Let's say you have a directory with few config files and you want to copy each\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8319,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/12\/10\/disappearing-files\/","url_meta":{"origin":9726,"position":2},"title":"Disappearing files","author":"Leonid Mamchenkov","date":"December 10, 2004","format":false,"excerpt":"Some known facts can use more reminders... Fedora Core Linux 2, as well as many other Linux and Unix machines, has a script (\/etc\/cron.daily\/tmpwatch) that is regularly executed by cron, which goes around your temporary directories and removes old files. This is a very useful utilty which helps to keep\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7366,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/check-if-the-file-is-in-the-archive\/","url_meta":{"origin":9726,"position":3},"title":"Check if the file is in the archive","author":"Leonid Mamchenkov","date":"March 23, 2004","format":false,"excerpt":"We all use gzip-ped tar achrives (.tar.gz) like mad. Sometimes, though, we need to check if the file is in the archive without extracting the whole damn thing on to the poor hard disk :) Consider for example, the presence of the .spec file in the .tar.gz, so that you\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16781,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/10\/02\/bash-directory-bookmarks\/","url_meta":{"origin":9726,"position":4},"title":"Bash directory bookmarks","author":"Leonid Mamchenkov","date":"October 2, 2012","format":false,"excerpt":"While reading through the comments to this Habrahabr article (in Russian), I came across an excellent tip for the directory bookmarks in bash shell. \u00a0Here's how to set it up. Firstly, add the following lines to your .bashrc or .bash_profile file: Secondly, if you are already using ~\/.bookmarks file for\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8614,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/02\/11\/converting-flac-to-mp3-on-linux\/","url_meta":{"origin":9726,"position":5},"title":"Converting FLAC to MP3 on Linux","author":"Leonid Mamchenkov","date":"February 11, 2005","format":false,"excerpt":"FLAC is Free Lossless Audio Codec. A 35 megabyte WAV file converted to FLAC will occupy about 25 megabytes. This is a good decrease in size, considering the fact that no quality is lost. But some files aren't all about quality and thus will be much better in mp3 or\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=9726"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9726\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=9726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=9726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=9726"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=9726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}