printf(".");//printf("Removed: %s\n", buf); // The file was removed
}else{
// The file was not removed, try to remove it as a directory
if(rmdir(buf)==0){
;//printf("Removed dir: %s\n", buf); // The dir was removed
}else{
// The directory was not removed, call this function again recursively
;//printf("Call rm_dir: %s\n", buf);
rmdir_recurs(buf);
rmdir(buf);
}
}
}
}
closedir(dirp);
}
NDB_COMMAND(init_rm,"init_rm","init_rm [path to dir]","Removes all files and dirs below [path to dir], default = /d/ndb/fs. WARNING can remove a lot of useful files!",4096){
if(argc==2){
printf("Removing all files and dirs in %s\n",argv[1]);
rmdir_recurs(argv[1]);
}elseif(argc==1){
printf("Removing all files and dirs in /d/ndb/fs\n");