Wild Card File Delete

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
piskie
Posts: 25
Joined: 2010-09-03 00:19

Wild Card File Delete

Post by piskie » 2012-05-17 01:28

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

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Wild Card File Delete

Post by Fred » 2012-05-22 22:24

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.

piskie
Posts: 25
Joined: 2010-09-03 00:19

Re: Wild Card File Delete

Post by piskie » 2012-05-26 14:06

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.

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Wild Card File Delete

Post by Fred » 2012-05-27 10:16

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

Post Reply