import java.io.File;
import java.io.IOException;
public class DeleteFolderFiles {
public static void main(String[] args) throws IOException {
String folder = "C:\\data";
File file = new File(folder);
System.out.println( file ) ;
if( file.isDirectory() )
{
String list[] = file.list() ;
if( list != null )
{
int size = list.length;
for(int i=0;i<size; i++ )
{
File f = new File(file.getPath() ,list[i]);
System.out.println("list = "+list[i]);
System.out.println(f.getAbsolutePath());
if(f.exists())
f.delete();
} // end For Loop
}// end 2nd If
}// end Main If
}// end Method
}// end Class
import java.io.IOException;
public class DeleteFolderFiles {
public static void main(String[] args) throws IOException {
String folder = "C:\\data";
File file = new File(folder);
System.out.println( file ) ;
if( file.isDirectory() )
{
String list[] = file.list() ;
if( list != null )
{
int size = list.length;
for(int i=0;i<size; i++ )
{
File f = new File(file.getPath() ,list[i]);
System.out.println("list = "+list[i]);
System.out.println(f.getAbsolutePath());
if(f.exists())
f.delete();
} // end For Loop
}// end 2nd If
}// end Main If
}// end Method
}// end Class
The material and aggregation is excellent and telltale as comfortably. Pyramid Analytics
ReplyDelete