Re: Need to find newest file in dirs
| From: | Justin French | Date: | Thu, 08 Aug 2002 15:23:38 +0000 |
| Subject: | Re: Need to find newest file in dirs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111669@lists.php.net to get a copy of this message | ||
I think you'll find that the only date associated with a unix-ish file will
be the date last modified, not the date written to disc, so you won't be
able to do it.
Justin
on 09/08/02 1:15 AM, Michael Carter (mcarter@ragingwire.com) wrote:
> Thanks, Justin.
>
> Yes, I agree on the OS issues. For the record, I'm using Solaris 2.6.
>
> The uploads are via FTP, so I *could* look at the logfiles for the last
> upload sorted by authorized users, but I was hoping for a php specific
> solution. I considered writing an upload page in php, but given ftp's
> integration into Microsloth Exploder, it'd be a lot of work that is
> already addressed.
>
> What I was looking for was something akin to a recurse of the user's
> directories, grabbing the image files, comaring dates and selecting the
> latest for that user. Then I was hoping to end up with an array of user
> => latest file/date. From that I would select the "newest" entry and
> display that user's name.
>
> Come to think about it, it would be even better to perhaps show the
> *last* date *per user* that a file was uploaded as well. Of course, if I
> can get over the initial hump this would be icing. :)
>
> #mikec
>
>
> -----Original Message-----
> From: Justin French [mailto:justin@indent.com.au]
> Sent: Thursday, August 08, 2002 8:07 AM
> To: Mike Carter; php-general@lists.php.net
> Subject: Re: [PHP] Need to find newest file in dirs
>
>
> This will be very OS-specific. The other problem will be that I *think*
> the
> only date associated with a file is the date last modified, NOT the date
> last written to HDD, but of course, that will vary with some OS's.
>
> When they upload, do they FTP, or do it via PHP scripts / browser?
>
> If so, then you can keep track of the latest files with either the file
> system or with a mysql database...
>
>
> Justin French
>
>
> on 09/08/02 12:55 AM, Mike Carter (mikec@aviate.org) wrote:
>
>> Hello all. I have a number of directories into which users can deposit
>> pictures which are displayed on the Web through a PHP viewer I wrote.
>>
>> I'd like to add the ability to show which user was the last to upload
> a file
>> to their directory so that as you visit the site you can see where new
> files
>> are without looking through every user's picture directory.
>>
>> The directory structure is dynamic; user's dirs come and go, and their
>> contents change. Here is the current structure:
>>
>> dir pics
>> |-- User1
>> |-- User2
>> |-- User3
>>
>> The end result I am looking for is the directory name which contains
> the
>> newest *.gif or *.jpg file. Then I'll either colour-code the username
> on the
>> web site or just print a line saying "Last upload: August 10, 2002 by
>> User1". Any help would be appreciated!
>>
>> Thanks..
>> MikeC
>>
>>
>