首页 > 其他分享 >android 删除文件错误:open failed: EBUSY (Device or resource busy)

android 删除文件错误:open failed: EBUSY (Device or resource busy)

时间:2022-11-08 11:07:52浏览次数:65  
标签:rename busy resource File System system failed file open


引用:

http://stackoverflow.com/questions/11539657/open-failed-ebusy-device-or-resource-busy







I have the big Answer!! The Problem comes from the Android System or / and the FAT32 system. I can not explain how the system get the error, it has something to do with deleting files and the FAT32 System.

But the solution is really easy: Before you delete a Directory or File: rename it!

Code to rename:

final File to = new File(file.getAbsolutePath() + System.currentTimeMillis());
file.renameTo(to);
to.delete();

Thats it, if you rename the folder or file before you delete it, there is no chance for the system to try to open an existing file again or an open file wich you want to save again (or something like this).



标签:rename,busy,resource,File,System,system,failed,file,open
From: https://blog.51cto.com/u_13316945/5832257

相关文章