deleting all files in a directory using c..
..here's a code i made to delete all files in a specified directory....
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
clrscr();
system("cd\\");
system("cd c:\\test_dir");
system("del *.* -f -s -q");
getch();
}
...but sadly, it won't work, and i don't know why. Whenever i run the program it outputs:
Too many parameters - -f
...i tried it in dos, it worked.. how come it won't work on c?
...is there a way to delete all files in a directory using c? thanks in advance... ^.^ :D