Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading dir but not all files!

Status
Not open for further replies.

MJB3K

Programmer
Jul 16, 2004
524
GB
Hi, i have this code that read's files from a dir, it works fine, but how can i have it exclude certain file types?? e.g. .htaccess files or .png files??
Code:
	$Open = opendir ("work/".$usr);
	while ($Files = readdir ($Open)) {
		$Filename = "work/".$usr ."/" . $Files;
		if (is_file ($Filename)) {
			$Size = filesize ("work/".$usr."/$Files");
			$SizeFormatted = round($Size/1024,0);
			$total += $SizeFormatted;
			echo "<li>$Files ($SizeFormatted KB)</li><br>";
		}//end if
any ideas??


Regards,

Martin

Gaming Help And Info:
 
Basically, you don't. If you don't want to use an entry, don't do anything with it.

The the example code in the PHP online manual entry for readdir().


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top