Jump to content

Counting Files


Miles LLC

Recommended Posts

I know how to count the files:

<?php
$dir = $_SERVER[DOCUMENT_ROOT]."/api/sigs/cache/".$i[id]."/";
$files = scandir($dir);
$result = count($files);

printf("$result Signatures Generated");
?> 

 

But i'm trying to make it so it only counts the files that were modified recently (That Day).

 

 

Try reading up here: http://php.net/manual/en/function.filemtime.php

Link to comment
https://forums.phpfreaks.com/topic/222242-counting-files/#findComment-1149649
Share on other sites

scandir will also have the "files"  '.' (here) and '..' (parent directory), be sure to filter those out. The directory will more than likely see its modified time updated when one of its files does.

 

I like is_file for as well, because file_exists() on a directory will be TRUE.

Link to comment
https://forums.phpfreaks.com/topic/222242-counting-files/#findComment-1149759
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.