Results 1 to 6 of 6
Can somebody tell me please how can I delete a directory along with all its sub directories and files in C?...
- 03-25-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
How can a delete a whole directory?
Can somebody tell me please how can I delete a directory along with all its sub directories and files in C?
- 03-25-2007 #2
Hi anayd,
Welcome to the LinuxForums.
check manual of 'rm' command.Code:rm -r <folder_name>
Code:man rm
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 03-25-2007 #3Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
Thank you devils_casper but I need to use that command in a C program.
I have the name of the directory in a var name and I tried to use
system("rm -r name"); but it doesn't work.
- 03-25-2007 #4
system function doesn't parse variables. concatenate 'rm -r' and directory name in a string xyz and pass it to system().
system(xyz);It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 03-25-2007 #5
sometimes may happen, that you will have to delete directory with force. In this case put rm -rf in your variable...
BTW: Casper, I like your avatar.
- 03-25-2007 #6Just Joined!
- Join Date
- Mar 2007
- Posts
- 6
Thanks
Thanks a lot devils_casper and jan1024188 ! It was very helpful


Reply With Quote