how delete directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
qumar
Forum Commoner
Posts: 29
Joined: Wed Nov 01, 2006 8:20 am

how delete directory

Post by qumar »

hi,
give some idea, how to delete directory in php. i know, how to delete file in the directory, but i didnot know, how to delete directory. please help to me.
thanks,
prabhu.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Use a recursive deleting function, or loop through your directory and delete.

Or, probably not a good idea:

Code: Select all

exec('rm -r /path/to/dir');
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Post by xpgeek »

http://php.net/rmdir - delete the directory.
Directory must be empty.
Post Reply