troubleshooting Question

Directory loop not outputing the first file name, but all of the rest

Avatar of tech1984
tech1984 asked on
PHP
2 Comments1 Solution199 ViewsLast Modified:
Attached is the code I am using. I am trying to get a list of files from a directory that have been modified within the last 15 minutes. The code is working in regards to the comparison of filemtime, but it outputs nothing but a period for the first file name, then all of the other file names are correct. Whats up with that. Thanks for your time
$fifteen_minutes_ago=time()-(1000 * 60);
$dir="XmlApp/Out/";
$f=opendir($dir);
while (($file=readdir($f))!==false && filemtime("$dir/$file")) 
{
	$file_date = filemtime("$dir/$file");
	if($file_date>$fifteen_minutes_ago)
	{
	echo "$file";
	}else{}
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros