Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello, i have a directory, and subdirectories that i'd like to count files in. i can do that by changing directories and hard coding them to glob and then count the arrays up, but thats no fun!

i've been trying to use file::find to find the image type which in this case is a photoshop file. I got to the point where i can find those files, but i have 2 questions.

1. how do i exclude the invisible files? 2. it gives me a output of filenames, but how to push that into a single array so i can quantify it?
#!/usr/bin/perl -w use Net::FTP; use File::Copy; use Mail::Sender; use Net::SMTP; use File::Find; use POSIX qw(strftime); my $time = strftime("%I:%M:%S",localtime); my $date = strftime("%m-%d-%y",localtime); my $aeropostale = "/Volumes/photorepos/Partners/Aeropostale/post/insto +ck/"; my $psd ="\.psd"; # chdir($aeropostale) or warn "can not get to $aerpostale $!\n"; foreach ($aeropostale) { find( { wanted => \&findfiles, }, "$aeropostale" ); sub findfiles { if (/$psd/){ print "$_\n"; } } }

In reply to trying to count files in a directory and subs by flieckster

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 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? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-09-26 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?