Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It also makes the directory handling more complicated as I need to check or create (regardless) the output folder for and every file created. Unless, I suppose, File:Find returns files in blocks so I can check the last folder created and only mkdir when needed.

Well if you think about it, you have to test each file and directory to find out if you are in the right one, then if each file in that subdir has a .png ending.

I think to save cpu cycles, in your case, I would run File::Find with a directory test before the file test. $File::Find::prune = 1 will skip processing any files in that subdir. Something like:

find sub { # first filter out your directories if (-d && $_ !~ / my_target_dirs_regex / ) { $File::Find::prune = 1; return; } # if you make it to here, you are in your target subdir # now do your ImageMagick processing and mkdir # it has to check each file for a .png ending if (-f && $_ =~ / (.*)\.png$ / ) { # do mkdir stuf # do ImageMagick stuff } # or you could just push the files into an array for later processing # push @goners, $File::Find::name; }, @ARGV;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^3: Recursive image processing (with ImageMagic) by zentara
in thread Recursive image processing (with ImageMagic) by wvick

Title:
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?
Username:
Password:

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

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

    No recent polls found