320 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

I been searching and trying to get this to work. I’ve gotten really close but I don’t want to screw this up because I have about 250 directories and I have to make sure I delete what I need deleted :D

OK, So I have about 250 directories and inside those directories there is a folder called “myImages”

Can any help me out and give me a example on how to delete “myImages” from all 250 directories? Just “myImages” tho.

I thought I would ask the pro’s instead of me screwing up something ;)

Thanks! Timothy

371 posts
  • Sells items exclusively on Envato Market
  • Won a Most Wanted contest
  • Made it to the Authors' Hall of Fame
  • Has sold $10,000+ on Envato Market
+5 more
amzee says

This is quite easy ;)

Steps:

1. Recursively read all the dirs 2. Get the absolute path of all the ‘myimages’ into a data structure say ‘Array’ 3. Run the process on new built array
foreach($dirs as $k=>$dir)
{     
    @unlink($dir);
}

hope this helps!

by
by
by
by
by
by