Reading Files in Perl

Posted on 2011-10-18
Last Modified: 2012-06-21

Can anyone help me with a code snippet to read  recursively dir and sub dir from a path and grep them by yesterday's date.

Question by:new_perl_user
    LVL 84

    Accepted Solution

    use File::Find;
    find(sub{print if -d && (-M) < 2},"/path");

    Author Comment


    Thank you it is working to an extent but it is printing out all the folders within a Sun dire too.
     Is there a way to print out only till Subdir level.


    Author Comment

    Can you please suggest  a solution for above one..
    LVL 84

    Expert Comment

    $\=$/;print for grep -d && (-M) < 2, <path/*/*>;

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now