When I booted my computer, I noticed:
- that the Trash icon was missing from File Manager;
- this message when I tried to delete a file:
Are you sure that you want to permanently delete "testFile"?
If you delete a file, it is permanently lost.
- that I can't restore already deleted files to their previous locations. I can do it manually, but there is no restore feature
I tired apt-get update
, apt-get update
, apt-get update --fix-missing
to try to repair anything broken.
Everything was working fine yesterday. However, I've been working on a java project to send files to trash. I made it about a month ago, so I am not sure if it is relevant, but here is the test code:
public class SendToTrashTest { public static void main(String... args) { try { File f=new File("test11"); f.createNewFile(); sendToTrash(f); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void sendToTrash(File f) { try { String s[]=f.getAbsolutePath().split(File.separator); String baseName=s[s.length-1],name=baseName; File trashInfoFile=new File(System.getProperty("user.home")+"/.local/share/Trash/info",name+".trashinfo"); //handles duplicate files for(int i=2;trashInfoFile.exists();i++) { name=baseName+="."+i; trashInfoFile=new File(System.getProperty("user.home")+"/.local/share/Trash/info",name+".trashinfo"); } //moves file to trash File trashFile=new File(System.getProperty("user.home")+"/.local/share/Trash/files",name); Files.move(f.toPath(), trashFile.toPath(), StandardCopyOption.REPLACE_EXISTING); //creates trash info file which is used to restore the trash file DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar cal = Calendar.getInstance(); trashInfoFile.createNewFile(); PrintWriter out=new PrintWriter(trashInfoFile); out.println("[Trash Info]"); out.println("Path="+f.getAbsolutePath()); //eg deletetion date: DeletionDate=2014-03-01T23:38:18 out.println("DeletionDate="+dateFormat.format(cal.getTime()).replace(" ", "T")); out.close(); } catch (IOException e) { e.printStackTrace(); } } }
I have no idea of how to fix my problem, so any help would be appreciated and thanks in advance.