So I wanna delete all my files in my directory because I cant be asked to delete them manually. I wrote this script which I think should of worked but it said "Malformed file name" when I executed my script. Here it is:
string[] files = File.FindFiles("r/documents");
number numFiles = Array.Length(files);
number fileIndex = 1;
while(fileIndex <= numFiles){
StringResult deletefile = File.Delete("r/documents", Util.ToString(files);
fileIndex = fileIndex + 1;
if(deletefile.GetResult()){
Console.WriteLine("deleting files");
}else{
Console.WriteLine("Error:"..deletefile.GetString());
}
}
If anyone can find the issue with this script then I'll highly appreciate it. Idk if its even possible so can someone clarify if it's even possible to do this. Thanks xx
string[] files = File.FindFiles("r/documents");
number numFiles = Array.Length(files);
number fileIndex = 1;
while(fileIndex <= numFiles){
StringResult deletefile = File.Delete("r/documents", Util.ToString(files);
fileIndex = fileIndex + 1;
if(deletefile.GetResult()){
Console.WriteLine("deleting files");
}else{
Console.WriteLine("Error:"..deletefile.GetString());
}
}
If anyone can find the issue with this script then I'll highly appreciate it. Idk if its even possible so can someone clarify if it's even possible to do this. Thanks xx