Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
That is sweet -- much more flexible/usable (in terms of renaming files) than the home-grown script that I wrote for myself years ago to do sort of the same thing. (But then, my script is actually meant to do anything you want with files or any list, not just renaming.)

Just one squib about your choice of semantics for the "-z" option: downcasing names is already pretty easy (in fact, I assume you can specify it separately, while still using "-z"). But something that's not so easy, and that comes up all too often, is whole bunches of file names that happen to include characters like  [<>|!=\&\$\#\(\)\[\]\{\}\\] (probably others as well), which tend to have special meanings in shell commands. When the unwitting shell user happens to do a quick "copy/paste" of such a name onto a command line, all hell breaks loose.

(I've seen file names like this created by "wget -r ..." as well as by "innovative" windows users putting files with "helpful" names onto volumes that are used by both samba and nfs.)

So, since there's already a way to downcase, but removing shell metacharacters can be an important issue in "sanitizing", how about the thrice-used "-z" handling the latter instead? (Note that a space really just another shell metacharacter -- so it makes sense to handle other such characters with the same option.)

(BTW, does "thrice used" mean "-zzz" or "-z -z -z"? I guess with the longer args it's an easier guess: "--sanitize --sanitize --sanitize", but that's a lot to put on the command line...)


In reply to Re: rename - an improved version of the script which comes with Perl by graff
in thread rename 0.2 - an improved version of the script which comes with Perl by Aristotle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (6)
    As of 2014-07-12 16:59 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (240 votes), past polls