Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6032781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:23:06+00:00 2026-05-23T05:23:06+00:00

Im writing script that creates list of all files and folders, and when next

  • 0

Im writing script that creates list of all files and folders,
and when next time it runs, i wanted to check if folder is modified since last time, and if not, exclude folder from reading this time,

I use filemtime(), and stat() function,

It works, when i add new files in subfolders date is changing, but if i edit file in folder, folder last modified date id not changing, using these functions.

Is there a way how to check if files in folder have been edited, without going through all files one by one??

this script will run very often, so i dont want so it goes through all files and folders every time,(in some folders there is a lot of files)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:23:07+00:00Added an answer on May 23, 2026 at 5:23 am

    This could work:

    function foldermtime($dir) {
        $foldermtime = 0;
    
        $flags = FilesystemIterator::SKIP_DOTS | FilesystemIterator::CURRENT_AS_FILEINFO;
        $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, $flags));
    
        while ($it->valid()) {
            if (($filemtime = $it->current()->getMTime()) > $foldermtime) {
                $foldermtime = $filemtime;
            }
            $it->next();
        }
    
        return $foldermtime ?: false;
    }
    
    var_dump(foldermtime(__DIR__));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Python script that reads a CSV file and creates a list
I'm writing a script that parses the pure-ftpwho -s command to get a list
I'm writing a script that can tar any given folder and place it in
I'm writing a greasemonkey script that creates an auto-complete search type box which makes
All, I am writting a php script that runs as part of a joomla
I'm writing a simple script that creates a new VirtualBox VM, spins it up
I'm writing a script that creates a popup that dims the screen behind the
Currently I am writing Perl script that creates LoadRunner scenario, execute the test, collect
I am writing a PHP script that needs to interpret Diff files as created
I'm writing a test for a Python script that returns a list of submitters.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.