skip to Main Content

PHP remove non-empty directory using Window Command.


PHP remove non-empty directory using exec windows command. On window operating system when we try to remove non-empty directory every time we get the “directory is not empty.” message when we try to remove directory using PHP.

Let’s see how we can remove non-empty directory using exec window command.

exec(‘attrib -r -a -s -h folderpath /s /d’);
exec(‘rd /s /q folderpath’);

Using above exec command we can remove the non-empty directory.

If you face any issue after using this code please write comment below.

Saroj

I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top