473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

most recent dated


Hi, how can I get the most recent dated file (or the last
created/modified) in a specified directory?

Thanks
Aug 25 '06 #1
3 1170
On Fri, 25 Aug 2006, Platero wrote:
Hi, how can I get the most recent dated file (or the last created/modified) in
a specified directory?
You can use scandir() to read all entries and filemtime() or stat() to get
the modification time of each entry.
Cheers, Peter

--
email: pmrb at free.fr
http://pmrb.free.fr/contact/
Aug 25 '06 #2
I hope it will help you :) ->
http://www.php.net/manual/en/function.filemtime.php
Now just write that simple algorythm : )

This is how to get file motification date
<?php
// outputs e.g. somefile.txt was last modified: December 29 2002
22:16:23.

$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename was last modified: " . date ("F d Y H:i:s.",
filemtime($filename));
}
?>

Aug 25 '06 #3

ok! Thanks very much! :-)
Aug 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID),...
3
by: Suresh Kumaran | last post by:
How do you program in VB.NET to show the most recent used document in a dropdown menu? I am referring to something like in MS WORD or EXCEL where it shows the recent document the user was working...
10
by: perryche | last post by:
Experts, I have the following scenario: Table1: RecordID RecordDate ... I want in a query to show me within this RecordID, only the latest RecordDate and info. I know I can use the Max...
3
by: manny | last post by:
Problem: how to have query show only most recent records. This query shows all exams in 2005 for particular individual (grades not shown to avoid embarrassing John Slacker!): SELECT...
4
by: Lee | last post by:
I have an application where I need to find the most recent file placed in a folder. For example, my users periodically place an image file with the format "ImageXXXX.jpg" (where XXXX is some...
2
by: robert.waters | last post by:
I need to perform the following: - select the most recent X number of records in a table (there is a timestamp field) - select the Nth occurrence of X number of records ex: - most recent 10...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
1
by: joanna | last post by:
Hi, I recently implemented the search script here on my website http://www.devpapers.com/article/306 However, what I want to do now is display the recent searches on the index of the site. How...
3
by: AnthonyT | last post by:
Hi All I have a major problem with an access query and I am near the end of my tether! I have taken over a project with a badly built access database and as resources are not available to start...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.