Lost Code on Copy-Paste


#1

I just had to close a two year long project due to the amount of data loss that just happened. I ran a public PHP project in which I performed a large push of data from a development build to my production build. Once I started using C9, I found it much easier to copy-paste my work from the dev build to the prod. However, the most fatal thing happened in my workspace today.

I copied my dev build as I always do, made sure nothing was selected, clicked my production build and removed it and replaced it instantly with the production build. Worked every time. However, this time, previously selected folders (my PHP’s code folder and JavaScript folder) were removed from both the production build and development build. Of course, I have backups, but in the passed 48 hours, more than two thousand lines of combined web code was written and tweaked. Our project has been cancelled due to this fatal incident.

Is the copy-paste feature limited on what it can do? Why did it not correctly copy what I selected? When I paste large amounts, it occasionally never pastes everything. I would have to restart Cloud9 to get it to work.


#2

Hi @StBashkir,

I’m really very sorry to hear that you lost a code that you were working on. I’d love to help if possible, but I’m afraid I’m still a little unclear as to what happened. Just to better understand the situation:

  • How were you copying and pasting the code? Using the UI? Are both builds on the same machine?
  • We usually keep backups for workspaces, but I think the workspace in question is an SSH workspace? and not Cloud9 hosted?
  • Did you get any console errors while copying or pasting?
  • Usually Copy / Paste works fine, but do you have an idea of how much data was being copy / pasted?

Regards,
​Mutahhir


#3

Have you tried going to File -> Show file revision history. It should have a history of all the code in your file and you can revert to any version you like. See How do I recover a deleted file? for more information.


#4

I copy and pasted using the workspace UI. I selected my files (in a folder) and used the shortcut Ctrl+C. Afterwards, I deleted the files from my main build (the files copied were from the developer build) then pasted the clipboard into the main build using Ctrl+V.

Noticing the missing folders that got pasted, I tried copy-pasting from the dev to the main once again. PHP and JavaScript source folders again weren’t there. So I checked the dev build. Lo and behold, they weren’t there either. Somewhere along the lines they were completely deleted. Which is why I cannot use @timjrobinson’s method.

Now, you could speculate that I did not completely deselect my folders in the dev build before deleting the main build. That would be incorrect. I single-clicked into the main build after I copied the dev build’s files. They could not have been selected (and if they were, they definitely should not have been via habitual use of the single-click to deselect anything).

The workspace is indeed SSH, and not Cloud9 hosted. No console errors arouse, and the amount of data was probably around 1GB.


#5

Did you try re-creating empty files and using revision history like that guide describes? We take frequent backups of all our hosted workspaces but cannot do this for SSH workspaces because it’s your private server. The file revision history is saved onto your server in a sqlite database in ~/.c9/[PROJECTID]/collab.db which is why it can be used to recover the files.