How to Get Unsaved Script Tabs

How to get unsaved script tabs

If you are on Windows, Go to the folder:

C:\Users\[your user]\AppData\Local\RStudio-Desktop\sources

update: since RStudio 1.4.* these sources were moved to:

C:\Users\[your user]\AppData\Local\RStudio\sources

the rest of the explanation remains the same.

and if you are on UBUNTU:

home/[your user]/.rstudio-desktop/sources

where there are all of your unsaved tabs in folders, especially those that begin with s like s-******.

There are two kinds of file (eg. D395C3B4 and D395C3B4-contents)

D395C3B4 file contains JSON information about your unsaved tab (eg. "tempName" : "Untitled76") and your correspanding codes are in D395C3B4-contents file.

Open D395C3B4-contents with notepad.

How do I recover an R script?

There is a file in my directory C:\Users\Mohammad Nabati\AppData\Local\RStudio-Desktop named history_database.1 that I found the history of running.

Recover unsaved SQL query scripts

Posting this in case if somebody stumbles into same problem.

Googled for Retrieve unsaved Scripts and found a solution.

Run the following select script. It provides a list of scripts and its time of execution in the last 24 hours. This will be helpful to retrieve the scripts, if we close our query window in SQL Server management studio without saving the script. It works for all executed scripts not only a view or procedure.

Use <database>
SELECT execquery.last_execution_time AS [Date Time], execsql.text AS [Script] FROM sys.dm_exec_query_stats AS execquery
CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql
ORDER BY execquery.last_execution_time DESC

Restore unsaved MySQL Workbench scripts?

You can try to find your script in History Output. Check this answer: MySql workbench query history ( last executed query / queries ) i.e. create / alter table, select, insert update queries



Related Topics



Leave a reply



Submit