By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,702 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

delete a nonempty directory using rmdir()

P: 23
Hi All,
Can some one help me how to delete a complete directory containing files and folders.
I can use system() command but i want use rmdir() and calling it recusively to delete the complete directory structure.

please if some one know how to work on both in windows and linux to work on rmdir() plz reply me,

Thanks .
Nov 18 '08 #1
Share this Question
Share on Google+
3 Replies

P: 13,264
Are you talking about the rmdir() function defined in unistd.h?
Nov 18 '08 #2

P: 23
Exactly i am asking about rmdir(), but this function is only used to delete a directory provided that it is empty, but this directory contains orther folder or files then how can we delete without using system command. rmdir /s .
Nov 18 '08 #3

Expert 10K+
P: 11,448
You have to be able to enumerate all entries in a directory and you have to be
able to check whether or not an entry is directory. If you can do that a recursive
function is a breeze.

kind regards,

Nov 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.