<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:D="DAV:" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:st="&#1;" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Z="urn:schemas-microsoft-com:"><head><META content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="text/html; charset=utf-8" http-equiv=Content-Type><meta content="Microsoft Word 12 (filtered medium)" name=Generator><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><BODY>
<DIV><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>There’s a page that covers the (many) ways to do it here:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><a href="http://stackoverflow.com/questions/4793892/recursively-rename-files-using-find-and-sed">http://stackoverflow.com/questions/4793892/recursively-rename-files-using-find-and-sed</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>I like keeping things conceptually simple, and easy-to-follow. One-liners are fun, but generally too clever to understand six months later. The way *<b>I’d</b>* handle it would be:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>---------------<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>#!/bin/bash<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>IFS=`printf '\n\t'`<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>for FILE in $(find . -name &quot;*.mp3&quot;)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>do <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>&nbsp;&nbsp;echo mv $FILE `echo $FILE | tr ' ' '_' | tr '[A-Z]' '[a-z]'`<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>done<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>----------------<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>There’s a couple tricks there. The main one is the “IFS” bit; that sets the “Internal Field Separator” to just tab and newline, so that spaces in filenames are preserved. I put that at the head of pretty much all my scripts these days, as files with spaces in the name are very common.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>As for the rest, it uses ‘find’ to do the recursion (you could change “*.mp3” to “*” to process all files) and then calls mv for each one. (Note the ‘echo’ before ‘mv’; right now I’m just debugging, so it prints out what it *<b>would</b>* do. Remove that first ‘echo’ to *<b>actually</b>* run the command.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> Sincerely,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> Ray Ingles&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (313) 227-2317<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> &quot;The America I feel allegiance to isn't the America that requires<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compulsory displays of loyalty.&quot; - Ron Rosenbaum<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div></div></div></div><BR></DIV>
<P ALIGN="left"><FONT FACE="Arial" SIZE="1"><FONT SIZE="2"><FONT SIZE="1"></FONT></FONT></FONT></P>
<P ALIGN="left"><FONT FACE="Arial" SIZE="1"><FONT SIZE="2"><FONT SIZE="1"><IMG ALIGN="baseline" ALT="" BORDER="0" HSPACE="0" SRC="cid:CPWRsig_04_11-03-2010.jpg@82324ee2.08114936"></FONT></FONT></FONT></P>
<P ALIGN="left"><FONT FACE="Arial" SIZE="1"><FONT SIZE="2"><FONT SIZE="1">The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it</FONT>.</FONT><BR><div class=WordSection1><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> mdlug-newbie-bounces@mdlug.org [mailto:mdlug-newbie-bounces@mdlug.org] <b>On Behalf Of </b>Mathew May<br><b>Sent:</b> Thursday, January 05, 2012 4:37 PM<br><b>To:</b> A place where there are no dumb (linux related) questions.<br><b>Subject:</b> Re: [mdlug-newbie] question about scripting<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;color:black'>Sorry,<br><br>The script I attached was a variant of the original one.&nbsp; This is the original script:<br><br>#!/bin/bash<br><br>ls | while read -r FILE<br>do<br>&nbsp; mv -v $FILE `echo $FILE | tr ' ' '_' | tr '[A-Z]' '[a-z]'`<br>done<br><br><br>Thanks,<br>Mat<br><br><o:p></o:p></span></p><div align=center class=MsoNormal style='text-align:center'><span style='font-size:10.0pt;color:black'><hr align=center id=zwchr size=2 width="100%"></span></div><p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;color:black'>From: </span></b><span style='font-size:10.0pt;color:black'>&quot;Mathew May&quot; &lt;mathewmay1@wowway.com&gt;<br><b>To: </b>mdlug-newbie@mdlug.org<br><b>Sent: </b>Thursday, January 5, 2012 4:23:40 PM<br><b>Subject: </b>[mdlug-newbie] question about scripting<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:10.0pt;color:black'>I am trying to write a script that will go through my current mp3 directory and change any space in a file name to an under score as well as change all upper case characters to lower case.&nbsp; I am new to scripting and I have done pretty good so far, but now I am trying to make my script recursive.<br><br>Here is what I have so far:<br><br>#!/bin/bash<br><br>#ls -R | while read -r FILE<br>for FILE in `find /home/mmay3/Music/tori_amos *.mp3 -type f`<br>do<br>&nbsp; mv -v $FILE `echo $FILE | tr ' ' '_' | tr '[A-Z]' '[a-z]'`<br>done<br><br>Any help would be greatly appreciated<br>Mat<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:10.0pt;color:black'><br>_______________________________________________<br>mdlug-newbie mailing list<br>mdlug-newbie@mdlug.org<br>http://mdlug.org/mailman/listinfo/mdlug-newbie<o:p></o:p></span></p></div></div></div><BR></FONT></P><FONT SIZE="+0"></FONT><FONT SIZE="+0"></FONT><FONT SIZE="+0"></FONT><FONT SIZE="+0"></FONT></BODY></HTML>