Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: remove files starting with white from its folders and sub folders using perl?

by Corion (Patriarch)
on Apr 17, 2017 at 10:20 UTC ( [id://1188119]=note: print w/replies, xml ) Need Help??


in reply to remove files starting with white from its folders and sub folders using perl?

glob does not handle whitespace well.

Replace your use of glob by opendir, readdir and closedir.

  • Comment on Re: remove files starting with white from its folders and sub folders using perl?

Replies are listed 'Best First'.
Re^2: remove files starting with white from its folders and sub folders using perl?
by choroba (Cardinal) on Apr 18, 2017 at 13:57 UTC
    > glob does not handle whitespace well

    It does, it treats it as a separator. Backslash it if you want it to interpret it literally:

    say for glob 'a b'; # Matches "a" and "b". say for glob 'a\ b'; # Matches "a b".

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re^2: remove files starting with white from its folders and sub folders using perl?
by gpssana (Initiate) on Apr 17, 2017 at 10:59 UTC
    How i can give opendir it will read only the respected directory location.Here i want to read all folders and sub folders
        That will convince OP

      How i can give opendir it will read only the respected directory location.Here i want to read all folders and sub folders

      Sometimes there isn't a way to do everything at once and you have to write code to perform the logic.

      Of course, as 1nickt pointed out, there are modules out there which have already coded the logic, so you can do it all at once.

      If you are constrained (for real or even if only in your imagination) from using a module, you'll need to write the code, and use of opendiris prescribed. (Hint: You'll have to do a loop, and recursion is usually employed as well.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-24 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found