Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Now that I have corrected the glob path array, only the FIRST _ character is being replaced, rather than every instance in the filename.

I just added an additional _ to a file in my test area and this problem occurs with my test code too.

Here's an example, names slightly modified.

rename(/mnt/hgfs/Subscriptions/Dr Wendy Testaburger/Dr Wendy Testaburg +er 20230523 Post_Stan_world 1920x1080.mp4, /mnt/hgfs/Subscriptions/Dr + Wendy Testaburger/Dr Wendy Testaburger 20230523 Post Stan_world 1920 +x1080.mp4)

For ease of reference, here is the relevant code:

my @path = glob("'$Subscriptions_Path/$_->{Lib_Sub_Path}/*'"); if (@path != 0) { File::Rename::rename(\@path,{ _code => sub { s/_/ / }, verbose => 1, no_action => 1, } ); };

In reply to Re^2: How to Rename files in multiple directories with a Perl script using an array of hashes. by ObiPanda
in thread How to Rename files in multiple directories with a Perl script using an array of hashes. by ObiPanda

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-05-30 00:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found