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

Re: Spaces in file names passed as arguments

by Utilitarian (Vicar)
on Sep 08, 2011 at 15:50 UTC ( #924843=note: print w/ replies, xml ) Need Help??


in reply to Spaces in file names passed as arguments

Using find and double quoting the {} in an exec allows you to do the whole library in one pass

find ./ -name \*\ \* -exec perl -e ' for (@ARGV){$new=$_;$new=~s/\s+/_ +/g;rename($_,$new);}' "{}" \;
Works for me

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."


Comment on Re: Spaces in file names passed as arguments
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://924843]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2015-08-01 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls