![]() The following function recursively deletes all occurrences of files matching the filename specified by an absolute path ($filepath). In order to automatically also delete these resized versions the base folder needs to be parsed recursively to delete all matching files contained. Finally, let’s say that these dimensions are part of the original filename, such as original_300x150.png and original_150x75.png. Furthermore, imagine the case that there exist multiple different thumbnail dimension formats, such as 300×150 and 150×75. These versions are kept inside subfolders names resized, thumbnails and icons respecively. ![]() ![]() ![]() For instance imagine the case when you want to delete an image that exists in multiple versions, such as the original, a thumbnail and an icon version. Sometimes it is nice to be able to recursively delete specific files in folder structures using PHP.
0 Comments
Leave a Reply. |