hi everyone,
i have a piece of code which i run through visualage. if i run it separately as a class , it deltes the files as wanted. but if i create an instance of that class and then call the fn which does besides other things deletes the files, it does not delete all the files. here is the code
import java.io.*;
public class Deletion {
public boolean deleteAll(
String fileName)
{
boolean status = false;
File f = new File(fileName);
if (f.list() == null)
{
System.out.println("can u delete file f " + f.canWrite());
status = f.delete();
System.out.println("1st status is " + status + " file name is " + f.getName());
}
else
{
String[] file_list = f.list();
System.out.println(file_list.length);
for (int i = 0; i < file_list.length; i++)
{
File f1 = new File(file_list[i]);
System.out.println(f.getPath() + "\\" + f1.getPath());
deleteAll(f.getPath() + "\\" + f1.getPath());
}
status = f.delete();
System.out.println("2nd status is " + status);
}
return status;
}// end of fn deleteAll
public static void main(String[] args)
{
Deletion d = new Deletion();
d.deleteAll("CFS Valid ValuesEJBDeployed");
}
}///end of class
///////////
in my other class , say class1 , i create an instance of class Deletion in one of its methods and then call the deleteAll() .but it deletes only some of the files in a directory. but if i run the Deletion class it deletes everthing.
i would highly appreciate if someone could help me out
thanks