Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^6: s// All Files In Directory

by perl.j (Pilgrim)
on Apr 02, 2012 at 22:54 UTC ( #963139=note: print w/ replies, xml ) Need Help??


in reply to Re^5: s// All Files In Directory
in thread s// All Files In Directory

This doesn't seem to be working...

Can't open *: Invalid argument.

--perl.j


Comment on Re^6: s// All Files In Directory
Download Code
Re^7: s// All Files In Directory
by vagabonding electron (Hermit) on Apr 03, 2012 at 09:53 UTC
    To tame the cmd you could use the brilliant idea which I read by BrowserUK (cannot find the link just now) - the following one-liner works on my windows pc:
    perl -pi.bak -e "BEGIN{@ARGV=map{glob}@ARGV;}s/5/6/g;" *
Re^7: s// All Files In Directory
by aaron_baugher (Deacon) on Apr 03, 2012 at 11:41 UTC

    A wild guess: On Windows, you used to have to use *.* to match all files, while a single * would only match files with no extension. Is that still the case?

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.

      Yes. Update:No. "*" matches all files and "*.*" the files with extension as shown below.

      With the files Text1.txt, Text2 and Test in the ordner C:/TEMP/TEMP/TEMP:

      C:\Perl\bin>perl -le "BEGIN{@ARGV=map{glob}@ARGV;}print for @ARGV" C:/ +TEMP/TEMP/TEMP/*.* C:/TEMP/TEMP/TEMP/Text1.txt C:/TEMP/TEMP/TEMP/Text2.txt C:\Perl\bin>perl -le "BEGIN{@ARGV=map{glob}@ARGV;}print for @ARGV" C:/ +TEMP/TEMP/TEMP/* C:/TEMP/TEMP/TEMP/Test C:/TEMP/TEMP/TEMP/Text1.txt C:/TEMP/TEMP/TEMP/Text2.txt
      The problem is - imho - the different behavior of globbing in the unix shell and under windows. With BEGIN{@ARGV=map{glob}@ARGV;} it can be treated.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-10-23 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (128 votes), past polls