import java.io.File[];
class FileDeleteDemo
{
public static void main(String[] args)
{
File[] dir=new File("d:\\d");
removeFile(dir);
}
public static void removeFile(File[] dir)
{
File[] files=dir.listFiles();
for (int x=0;x<files.length;x++)
{
if (files[x].isDirectory())
{
removeFile(files[x]);
}
else
System.out.println(files[x].toString()+"-file-"+files[x].delete());
}
System.out.println(dir+"+dir+"+dir.delete());
}
}
|
|