How to recover deleted iPython Notebooks

后端 未结 12 741
礼貌的吻别
礼貌的吻别 2020-12-03 11:05

I have iPython Notebook through Anaconda. I accidentally deleted an important notebook, and I can\'t seem to find it in trash (I don\'t think iPy Notebooks go to the trash).

相关标签:
12条回答
  • 2020-12-03 11:25

    On linux:

    I did the same error and I finally found the deleted file in the trash /home/$USER/.local/share/Trash/files

    0 讨论(0)
  • 2020-12-03 11:27

    The "delete" functionality now sends the file to OS trash rather than permanently deleting it, see this PR: https://github.com/jupyter/notebook/pull/1968. So you can just open your Trash (wherever that is on your system) and restore it.

    0 讨论(0)
  • 2020-12-03 11:32

    I think the easiest way (until developers handle this issue) to retrieve your Ipython history is to write them all into an empty file.

    You need to check by the date you created your last script. Obviously, it is going to be the last part of your Ipython history.

    To write your Ipython history into a file:

    %history -g -f anyfilename
    
    0 讨论(0)
  • 2020-12-03 11:32

    If you're using windows, it sends it to the recycle bin, thankfully. Clearly, it's a good idea to make checkpoints.

    0 讨论(0)
  • 2020-12-03 11:33

    I had the very problem and I ended up solving it this way. It might be the case for some of the folks.

    0 讨论(0)
  • 2020-12-03 11:35

    Sadly my file was neither in the checkpoints directory, nor chromium's cache. Fortunately, I had an ext4 formatted file system and was able to recover my file using extundelete:

    1. Figure out the drive your missing deleted file was stored on:

      df /your/deleted/file/diretory/

    2. Switch to a folder located on another you have write access to:

      cd /your/alternate/location/

    3. It is proffered to run extundlete on an unmounted partition. Thus, if your deleted file wasn't stored on the same drive as your operating system, it's recommended you unmount the partition of the deleted file (though you may want to ensure extundlete is already installed before proceeding):

      sudo umount /dev/sdax where sdax is the partition returned by your df command earlier

    4. Use extundelete to restore your file:

      sudo extundelete --restore-file /your/deleted/file/diretory/delted.file /dev/sdax

    5. If successful your recovered file will be located at:

      /your/alternate/location/your/deleted/file/diretory/delted.file

    0 讨论(0)
提交回复
热议问题