平常工作过程中,经常碰到这样的情况:
解锁工具Unlocker试用_第1张图片
Unlocker就是解决这样问题的好工具:
How often have you tried to delete or rename a file or folder and got "Cannot delete xxx: It is being used by another person or program." ?
Unlocker is a tool which will help you overcoming this scandalous Windows bug.
试用一下效果:
   public static void main(String[] args) {
    File f = new File( "D:\\My Documents\\flash\\LockTest.txt");
     try {
      BufferedReader read = new BufferedReader( new FileReader(f));
      String s =read.readLine();
       while(s!= null){
        System.out.println(s);
        s = read.readLine();
      }
      System.in.read();
    } catch (FileNotFoundException e) {
       // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
       // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
打开一个txt文件,并且一直占用(通过等待控制台输入来实现),之后在资源管理器中尝试进行删除操作,顺利出线了上面的提示信息,删除失败。
再次执行上面的程序,之后在资源管理器中选中txt文件并右键选择Unlocker项,在弹出来的窗口中选中相应条目并点击“解锁”按钮,之后就可以成功删除了:
解锁工具Unlocker试用_第2张图片