This is my second stupid, newbie question, but please don't flame me. I couldn't find it in the tutorials or in the FAQ.
How do you delete entire folders, all at once?
This is my second stupid, newbie question, but please don't flame me. I couldn't find it in the tutorials or in the FAQ.
How do you delete entire folders, all at once?
you have to delete all the files within the folder first, then delete the folder.
i think he wants to send a program to a friend that will delete a folder and all its contents from his friends computer
btw i dont know how
Paro
I need it because i'm writing a program which deletes the windows temporary internet files (The REALLY hidden, not just hidden). I don't know how to delete anything, and even if I did, I wouldn't know what to delete, since the Temp files are different on every computer.
i dont even know how to delete files, could someone fill me in on that
Paro
The function remove will erase files, its in <stdio.h>.
it returns zero if successfulCode:int remove(char *filename);
All spelling mistakes, syntatical errors and stupid comments are intentional.
Does it work with folders?
use rmdir command in dir.h
rmdir deletes the directory whose path is given by path. The directory named by path
must be empty
must not be the current working directory
must not be the root directory
rmdir(path);
-
or... the inevitible and slow system command that doesn't matter if there is files in it...
With the only problem being that it may ask you if "you are sure (y/n)".Code:system ("deltree C:\\directory");
system is found in stdlib
BZ out...
***edit****
The /Y switch will allow you do it without the prompts sooooo...
system ("deltree /Y C:\\directory");
Last edited by Betazep; 03-02-2002 at 10:21 PM.
Blue
>>i think he wants to send a program to a friend that will delete a folder and all its contents from his friends computer
btw i dont know how<<
and you know what the sad thing is.... it doesn't come up as a virus.
Blue
This works well to
rmdir /s/q dirName
whole dir, all files, any subfolders No Y/N questions
-----------------------------------------------
everready
To code, or not to code, that is the question.
Well the answer is 'TO CODE' of cause