Using Java's File.delete() method

馋奶兔 提交于 2019-11-29 15:43:31

It's gone. The trash bin is just a temporary place where files are put before being deleted, when you "delete" them through the OS.

In most filesystems, however, deleting a file only removes the pointer to it from the system's list of files. The actual data may sit on the harddrive for a significant amount of time until it is overwritten. There are file recovery tools available that can attempt to retrieve such files, but they are not 100% sucesfull.

The trash in Mac/Linux (or Recycle Bin, in Windows) only work with the specific file managers (Finder, Nautilus/Dolphin or Explorer) where they actually move a file into a temporary folder on the same partition (aka Trash / Recycle Bin), from where it's deleted.

From the core OS's point of you, delete() will permanently delete it.

where the file is being stored?

It isn't. You deleted it. It's deleted.

Calling File.delete() permanently removes the file, without going into the recycling bin or anything similar.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!