Re: directory modification dates

From: Date: Fri, 19 Oct 2007 19:42:54 +0000
Subject: Re: directory modification dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263421@lists.php.net to get a copy of this message
On Sat, 2007-10-20 at 01:36 +0300, Marek wrote: > I have a simple directory listing script - you can move up and down > directories and it shows the files/dirs inside. Now I have to figure out > a way to display the latest modification time for each directory. > > The problem is that filemtime() works only if the modifications are done > on the first level. For example, if I add files in dir1/dir2/dir3/, then > the modification time for dir1 doesn't update. > > My first instinct was to find the correct time recursively on each load > but there are so many files and so many visitors that it clogs the > server. I have a few other ideas but they seem rather ugly (like hidden > files with stored info in each directory). > > Can you suggest any better ways to approach this problem? When a file is uploaded/changed ascend the directory tree and touch() each of the directories. http://ca.php.net/manual/en/function.touch.php Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ...........................................................

« previous php.general (#263421) next »