/**
* 删除指定目录和子目录下的所有文件
* @author Bian Jiang
* @since 2008.06.03
* @param filePath
*/
public static void delAllFile ( String filePath ) {
log . debug ( "开始删除文件:" + filePath );
try {
File file = new File ( filePath );
File [] fileList = file . listFiles ();
String dirPath = null ;
if ( fileList != null ) {
for ( int i = 0 ; i < fileList . length ; i ++) {
if ( fileList [ i ]. isFile ()) {
fileList [ i ]. delete ();
}
if ( fileList [ i ]. isDirectory ()){
dirPath = fileList [ i ]. getPath ();
delAllFile ( dirPath );
}
}
file . delete ();
}
} catch ( Exception ex ) {
log . error ( "删除文件失败:" + filePath );
}
}
* 删除指定目录和子目录下的所有文件
* @author Bian Jiang
* @since 2008.06.03
* @param filePath
*/
public static void delAllFile ( String filePath ) {
log . debug ( "开始删除文件:" + filePath );
try {
File file = new File ( filePath );
File [] fileList = file . listFiles ();
String dirPath = null ;
if ( fileList != null ) {
for ( int i = 0 ; i < fileList . length ; i ++) {
if ( fileList [ i ]. isFile ()) {
fileList [ i ]. delete ();
}
if ( fileList [ i ]. isDirectory ()){
dirPath = fileList [ i ]. getPath ();
delAllFile ( dirPath );
}
}
file . delete ();
}
} catch ( Exception ex ) {
log . error ( "删除文件失败:" + filePath );
}
}