filemtime

How to check if directory contents has changed with PHP?

I'm writing a photo gallery script in PHP and have a single directory where the user will store their pictures. I'm attempting to set up page caching and have the cache refresh only if the contents of the directory has changed. I thought I could do this by caching the last modified time of the directory using the filemtime() function a...

filemtime() not working in Windows PHP-CLI

I just got PHP-CLI working on my Windows machine so I could create scripts using PHP. However, I'm trying to write a script to cleanup my Firefox downloads folder of files older than X number of days, but I can't seem to get the filemtime() function working. Here is the function I wrote: function deleteOldFiles($dir, $days) { $mydir...

How-to watch mtime changes in course of php script?

Hi all I'm trying to watch for a file being modified in a long running php script. The basic algorithm is this: ... $mtime = filemtime($filename); sleep($delay); if($mtime < filemtime($filename)) ... // do something because file was changed elsewhere Problem is filemtime returns the same value withing same script, e.g. if a scr...

Accuracy of stat mtime in Windows

Have an example piece of (Python) code to check if a directory has changed: import os def watch(path, fdict): """Checks a directory and children for changes""" changed = [] for root, dirs, files in os.walk(path): for f in files: abspath = os.path.abspath(os.path.join(root, f)) new_mtime = os.sta...

CSS Parser - Insert mtimes

What command line tool can I use to automatically insert mtimes into urls in my css files for the purposes of breaking the cache? /* before */ .example { background: url(example.jpg); } /* after */ .example { background: url(example.jpg?1271298451); } Also, I would like this tool to spit out the latest mtime as the css files mtime. (...

Known problems with filemtime() on Windows - files getting touched arbitrarily?

Is there a known issue leading to file modification times of cache files on Windows XP SP 3 getting arbitrarily updated, but without any actual change? Is there some service on a standard Windows XP - Backup, Sync, Versioning, Virus scanner - known to touch files? They all have a .txt extension. If there isn't, forget it. Then I'm gett...

PHP file modification time in milliseconds

I there, I am currently writing a unit test which asserts that a file did not get modified. The test code execution takes less than one second and therefore I would like to know if it is possible to retrieve the file modification time in milliseconds. filemtime() function returns the UNIX timestamp in seconds. My current solution is usi...

Filemtime/cachetime where am I going wrong?

What I am trying to do is check the age of an image, if its older than 60 minutes then run another php page to fetch images otherwise do nothing if less than 60 minutes old.... The script isn't opening the 2nd page (radartest.php) and running it to update the images, so need a command to tell it to run as a script please. <?php $imagen...