Visual Studio is a popular code editor. Have you accidentally deleted your VS Code file before saving it? Or have you lost your file due to some technical glitch? Losing code files can be really frustrating. It takes a lot of time to write back the code. Also, there will always be confusion about whether you have covered all the cases from your original code. Especially if you are working on a hugely complex project, the effort that should be taken is really high. To cope up with all these difficulties and to save your precious time in rewriting the code file, it is better to try recovering your file.
Having trouble recovering your file? Not clear how to do it? We are right here to help you out! We have listed a few possible methods to help you get back your deleted and unsaved VS Code files. Keep reading to find the perfect solution that best suits your needs –
Method 1 – Restoring a Deleted VS Code File From Your Recycle Bin
Almost everyone knows how the Recycle Bin on your computer works. Similar to the other type of files, the VS code files also end up in the Recycle Bin after you delete them. They stay here in the Recycle Bin until they are permanently deleted. So you can easily visit your personal Recycle Bin and restore your deleted VS code file. Here is how you do it –
- Open the Recycle Bin from your system’s desktop (This is the default location, but if you have moved it elsewhere, just search it with your File Explorer).
- Find the Visual Studio code that you have deleted.
- Right click on the file and click Restore.
That’s it! Your deleted VS code file has now been restored to its original location. However, in certain cases, you may have deleted or emptied the contents from your Recycle bin. Or else, you may have even closed your application without saving your code file. In such cases, you may not be able to find your lost Visual Studio Code in your Recycle Bin. Keep reading the next methods to find the best solution.
Method 2 – Searching for Unsaved Files Manually
At several times, we may tend to close our program before saving it. Or sometimes, there may be a technical glitch that has closed our program before we save it. In such cases, your code won’t be there in your system. You will have to rewrite the code, however long it is. To overcome that, we are here with a solution. Just follow the steps given below and you can get back your unsaved Visual Studio Code files.
To cope up with these accidental mistakes, Visual Studio has come up with a method to get back your unsaved files. Yes, you heard that right! All your unsaved files are right there on your device storage. You just need to search for the exact file you want. Once you find them, you can easily restore them back to the code editor. But, where should you search for your files? To make things easier, we have given you the locations of all your unsaved VS code files on your system. Just go to the File Explorer, reach the exact path according to your operating system, and you will find all your unsaved files there –
Windows
If you are using a Windows operating system, then your Visual Studio code files can be found at –
"%appdata%/Code/Backups"
The insiders can be found at –
"%appdata%/Code - Insiders/Backups"
The OSS backups can be found at –
"%appdata%/Code - OSS/Backups"
MacOS
If you are using a Mac OS, then you can find all your Visual Studio code files at –
"$HOME/Library/Application Support/Code/Backups"
Find all your Insiders at –
"$HOME/Library/Application Support/Code - Insiders/Backups"
Find all your OSS backups at –
"$HOME/Library/Application Support/Code - OSS/Backups"
Linux
If you are working on a Linux operating system, then you can find all your unsaved Visual Studio code here –
"$HOME/.config/Code/Backups"
Find your Insiders at –
"$HOME/.config/Code - Insiders/Backups"
All your OSS backups can be found at –
"$HOME/.config/Code - OSS/Backups"
Method 3 – Locating Unsaved Files through Visual Studio
If you find it difficult to locate your unsaved files in the above location, or if you cannot find your files even in the given location, there is another option for you. Visual Studio provides a dedicated extension on plug-ins called Unsaved Files to locate all the unsaved VS code files. When you activate Unsaved Files, all your unsaved files are easily accessible right from the Visual Studio platform! Unsaved Files provides you three views of data –
- Show all unsaved files on the Command Pallete
- Show all unsaved files on the Status Bar
- List all unsaved files from view on Explorer
You can install Unsaved Files from the official Visual Studio Marketplace.