Page 1 of 1

PHP FILES

Posted: Tue Dec 30, 2008 4:36 am
by truepal20032001
How would i say in php to delete all the files with the same filetype, like... delete all JPGs from this folder... but only the jpgs...

Re: PHP FILES

Posted: Tue Dec 30, 2008 4:54 am
by jaoudestudios
If you are using php5, then you can use scandir to scan the directory, then check the extension, if the extension matches what you want, then unlink the file.

Re: PHP FILES

Posted: Tue Dec 30, 2008 5:03 am
by VladSun
I would prefer using glob() in this case.

Re: PHP FILES

Posted: Tue Dec 30, 2008 5:07 am
by jaoudestudios
Cheers VladSun. I did not know about that, I have just looked it up, very useful :)

Re: PHP FILES

Posted: Tue Dec 30, 2008 2:22 pm
by truepal20032001
Thankyou very much!