Help with php file lookup
Moderator: General Moderators
Help with php file lookup
i need to write something to look in a directory and see if a file with an extension of tar.gz exists if so i need to delete it. How would i do that?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Help with php file lookup
Ok here is what i have but it doesn't work
Code: Select all
<?php
foreach (glob("/home/myusername/*.gz;") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
echo "filename - " . $filename;
?>