Re: file import / feed

From: Date: Tue, 15 Aug 2000 05:47:08 +0000
Subject: Re: file import / feed
Groups: php.general 
Request: Send a blank email to php-general+get-11735@lists.php.net to get a copy of this message
Addressed to: Dieter Kneffel <data@wap4.com> php-general@lists.php.net ** Reply to note from Dieter Kneffel <data@wap4.com> Tue, 15 Aug 2000 06:21:26 +0200 > > BTW: The folder is local, I need to accomplish this using PHPs > filesystem functions. Looking at the manual, I found no 'ls' or 'dir' > equivalent so far. > Look in Directory Functions. opendir(), readdir(), closedir() > I have a folder where new files are uploaded. All files have unique > names. How would I check the folder for new files without knowing > their names? > Look in Filesystem functions for: filemtime() Assuming a new file is one less than a day old... $Dir = '/path/to/the/directory'; $Time = time() - 86400; # 86400 = 60 * 60 * 24 or the number # of seconds in a day. $D = opendir( $Dir ); while( $Name = readdir( $D )) { if( is_file( "$Dir/$Name" ) AND filemtime( "$Dir/$Name" ) > $Time ) { echo "File is less than one day old: $Name<BR>\n"; } } closedir( $D ); untested, but it should be pretty close... Rick Widmer Internet Marketing Specialists www.developersdesk.com

« previous php.general (#11735) next »