强行删除文件代码

public static boolean forceDelete(File f)
{
boolean result = false;
int tryCount = 0;
while(!result && tryCount++ <10)
{
System.gc();
result = f.delete();
}
return result;
}

posted on 2018-08-30 19:26  哲航  阅读(513)  评论(0编辑  收藏  举报