Page 1 of 1

Wild Card File Delete

Posted: 2012-05-17 01:28
by piskie
Does anyone know if ADDT will delete all files in a Folder by defining the File name using a wild-card,
Example: directory/*.jpg

Re: Wild Card File Delete

Posted: 2012-05-22 22:24
by Fred
Short answer is no.
You will have to write a custom transaction for that.

Found this http://psoug.org/snippet/PHP-Delete-by-wildcard_49.htm as an example of how you can do that.
No idea if it will work.

Re: Wild Card File Delete

Posted: 2012-05-26 14:06
by piskie
Thanks for the reply Fred.
I was hoping to be able to Delete Record and then Delete client/images/*.jpg plus client/images/thumbnails/*.jpg
This could involve a hundred or so images in that clients directory.
So, if it's not possible, then I must do a manual remove of Images after deleting client record.

Your other suggestion is interesting, but I need to work with it to find its boundaries.
It looks frighteningly powerful if it got out of bed.

Re: Wild Card File Delete

Posted: 2012-05-27 10:16
by Fred
If only it was that easy, Problem is we are coding and not using someone else's program to do the work.

You need to look at the unlink() and rmdir() functions in the php manual.

Here is another one you might want to look at.
http://stackoverflow.com/questions/4490 ... ive-delete