Saturday, November 5, 2011

PHP script to delete thousands of jpgs


I seen this query on guru.com  but I can not do the  bit this project. But  I done this task.  
Client Requirement

Hi, my webcam is uploading .jpg files to my shared webhost and I need you to create and install a php script that will delete all .jpg files in the public_html/cams/ folder and subfolders. Because there are so many images the script must find and delete images in small batches so that it doesn't crash my shared server. It must be able to find and delete jpg images in all subfolders of the cams/ directory. ( I add new folders for new cams sometimes and I don't want to have to update the script each time I add a new subfolder with cam images ).

It should only delete .jpg files that have dates in them like:
cams/cable/2011-10-14_14-15-42.jpg

Solution :
I have solve your problem with the help of php script,
My  script delete  public_html/cams/ “ only .jpg file all file’s.
My  script delete  public_html/cams/ folder”  only .jpg file all file’s.
My  script delete  public_html/cams/ folder/sub-folder”  only .jpg file all file’s.
My Script go on (Work) 3 sub folders and increase many subfolder on clients demand.   


No comments:

Post a Comment