thara Posted February 8, 2016 Share Posted February 8, 2016 (edited) I am trying to remove folders and its files and sub folders using php.This is how I tried it. $dir = "../../images/$category_id/$delId"; $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); foreach($files as $file) { if ($file->isDir()){ rmdir($file->getRealPath()); } else { unlink($file->getRealPath()); } } rmdir($dir); This is working on php 5.5+, but is doesn't work in php 5.2.17. This is the error can I get when it running on php 5.2.17 <br /> <b>Fatal error</b>: Undefined class constant 'SKIP_DOTS' in <b>/home2/public_html/admin /includes/process_edit.php</b> on line <b>124</b><br /> Can anybody tell me how I get it to work on 5.2 also.Thank you. Edited February 8, 2016 by thara Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted February 8, 2016 Share Posted February 8, 2016 Nobody should be using php 5.2, at a minimum some hosts using 5.4, really should be 5.5+ and php7 is here. Quote Link to comment Share on other sites More sharing options...
benanamen Posted February 8, 2016 Share Posted February 8, 2016 FYI: Php 5.2 is over one hundred versions behind. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.