3

I've been writing a .cpp file for two entire days now. It was just that one file, for an university project. So, I finally finished the code, and I decided to see if I could make a C interface to use it in C (generating the .o files with g++ and then linking them together to use with gcc). So I executed a g++ command which removed the .cpp!! (Cool, ahn?!)

It was opened in the VS Code, but the editor closed the file as soon as it was deleted (omg why?! worst design decision ever but whatever). Is there any way to recover the file? It's not in the recycle bin.

Rafael Perrella
  • 76
  • 1
  • 1
  • 5
  • Possible duplicate of [.cpp file vanishes after compilation](http://stackoverflow.com/questions/20056315/cpp-file-vanishes-after-compilation) – GSerg Apr 08 '17 at 20:09
  • Possible duplicate of [How can I recover source overwritten by a bad compile command?](https://superuser.com/q/195569/52365) – GSerg Apr 08 '17 at 20:10
  • 1
    Clearly not a duplicate. I'm asking for a way to recover the deleted file using VS Code. – Rafael Perrella Apr 08 '17 at 20:12
  • Also notice that it doesn't matter whether VS Code was with autosave on/off, since the file I was editing was removed. I need to know whether it keeps some cache somewhere else or not. Thanks anyway =/. – Rafael Perrella Apr 08 '17 at 20:14
  • 1
    Possible duplicate of [Visual Studio Code backup mechanics](http://stackoverflow.com/q/42635755/11683) – GSerg Apr 08 '17 at 20:19
  • Thanks, I think that answers the question. Seems like I really lost my file =/. – Rafael Perrella Apr 08 '17 at 22:01

1 Answers1

2

I was recently using VS Code server (i.e., SSH into remote machine) when I "Permanently Deleted" the wrong file. I was able to find it in /home/{username}/.vscode-server/data/User/History under the temporary files & folders by looking at the most recently used items. Hope this helps someone else!

Raj K
  • 329
  • 1
  • 7
  • 1
    Thank you!!! My ssh connection dropped and my edits were gone.... By looking in the folder on the remote server in the directory /home/{username}/.vscode-server-insiders/data/User/History, I found various folders with 8 digit number names. Each folder is for a single file with various versions of the file. The file name is in a file called entires.json. Just sort the underlying files by date and grab the latest. In my case, I looked under ~/.vscode-server-insiders directory. Thank you! – Gardener Jun 27 '23 at 03:35