Corrupted script files, any possible recovery?

wavepan86

New member
Joined
May 31, 2020
Messages
1
Programming Experience
1-3
Hi C# community,

Inadvertently, I did the unthinkable and somehow ended up corrupting my scripts for my app I'm developing on Unity.

I was transferring things between a flash drive and my MacBook, and ended up breaking apart my Unity project while it was open.

The script files in question now contain zero bytes, as do these interesting sort of 'meta' files, that seem to be parts of an encrypted file or something. Might there be any chance that a recovery could be made from this?

Name of the script file is partially blanked out.

FYI my coding knowledge is novice-at-best - but I did learn some C# for working in Unity.
My apology if there's a better suited topic forum for this. Thank you for reading!

Screen Shot 2020-05-31 at 4.16.09 PM.png


EDIT: The file types are 'Document.'
 
Last edited:
I have my doubts that it would be possible to recover that data automatically, although I can't say for sure as I've never used Unity or VS for Mac. What I will say is that you should have a backup that you can fall back to but you probably don't. You should immediately remedy that so that you don't lose everything again in future. You can create local backups manually but I would suggest that you setup some form of source control, e.g. DevOps or GitHub. That way, even if your home burns down and you lose your machine and every local backup, you still have your source code in the cloud and that you can recover anywhere, any time.
 
I'm incline to agree with JM. They may not be recoverable, but I'm optimistic. As an aside; Visual studio must reserve copies of all files from all projects. We know this from when Visual studio suddenly crashes, or when your project was closed abruptly. Ie using a kill command or your house looses power while your project is open.... my point being and this may be a goose chase. But, it might be worth asking this question on Visual studios forums and ask them about their backup feature, and where those files may be stored. Clearly, (and I am assuming) if your project crashes, Visual studio always offers to restore the project for us in such events. So there must be a shadow copy somewhere? Or maybe try to find out where or how Visual studio does such backups or is able to restore previous editions of your project when they fail to shutdown properly.

Oh and welcome to the forums. ;)
 
Perhaps glance at this and hope for the best : Did you know... Where Visual Studio saves auto-recovered files in the case of an unexpected shutdown? - #151

Alternatively, you may also be able to download an undelete program to recover deleted patterns from your hard drive. Providing you saved your file at one time. Then those bytes of data have been written to allocated 'free space' in your hard drive.

When data is removed from a file and the file is saved. Your file is often rewrote by a new buffer with new allocation memory addresses, formally known as memory blocks. And the previous space which contained your files contents is simply moved and fragmented and then overwritten with 'blank allocation blocks'. This is done so new information can be wrote to those memory addresses.

Using an undelete application may restore a lost file or a previous version of your file by reversing the ordering of the fragmented allocation blocks; thus makes your data recoverable. That's how undelete programs work. Just because you delete or remove something from your hard drive, it's not actually fully deleted. And these files can always be restored. Providing you're not using any bleaching programs, your data can likely be recovered with a good undelete program.

Either way, good luck with the process.
 
VS 2019 has backup files in %LocalAppData%\Microsoft\VisualStudio\BackupFiles, and I remember them being in %userprofile%\Documents\Visual Studio <version>\Backup Files\ in previous VS versions.
 
As the documented link I posted states. In Tools => Options => Environment, => AutoRecover - unless this is turned off, the backup files should be stored in the second path posted by John.

Hopefully you still have AutoRecover swithced on. I don't know why anyone would be crazy enough to have it switched off in the first place.
 
As the documented link I posted states. In Tools => Options => Environment, => AutoRecover - unless this is turned off, the backup files should be stored in the second path posted by John.

Hopefully you still have AutoRecover swithced on. I don't know why anyone would be crazy enough to have it switched off in the first place.
Are those files retained after a successful exit? I would have thought that they would be created while running so that a sudden end could be recovered from but, if a solution is successfully closed properly, then they would be deleted. Maybe I'm wrong about that or maybe there wasn't a clean shutdown in this case. It's a possibility to be prepared for though.
 
Are those files retained after a successful exit? I would have thought that they would be created while running so that a sudden end could be recovered from but, if a solution is successfully closed properly, then they would be deleted. Maybe I'm wrong about that or maybe there wasn't a clean shutdown in this case. It's a possibility to be prepared for though.

Oh oh, oh no. Looks like you're right John.

It appears that these files are only backed up and stored while the project is open and you are committing saves. After which case, if a project is instructed to close, and if it has done so successfully, those backup files get removed. Well spotted my friend.

Well that's rather disappointing.
 
Actually. They are not backed up even on saves. I noticed I had backup folders only from applications which previously crashed on me. My currently opened project doesn't have a backup folder at all, even after saving the project. I now assume they are only created if a project crashes, and the backed up files are deleted upon restoration of the file being restored or if you choose skipping restoring the previous file at the next launch of the crashed project.
 
Anyway, I hope that this was a learning experience for our OP with regards to using backups and source control.

I've heard many Mac users say they were very happy with Code 42 until they started just focusing on small businesses and enterprises rather than home users. Personally, I just continue to use Acronis for local backups out of long time familiarity with them. I've not tried Acronis' cloud based backups.

For source control, I use git and Mercurial, and push copies of stuff that I really care about out to Bitbucket or Github. I used to prefer Mercurial, but with the world moving to git, and Bitbucket dropping support for Mercurial, I'm now using git about 90% of the time.
 
Are those files retained after a successful exit? I would have thought that they would be created while running so that a sudden end could be recovered from but, if a solution is successfully closed properly, then they would be deleted. Maybe I'm wrong about that or maybe there wasn't a clean shutdown in this case. It's a possibility to be prepared for though.
Looking closer, all folders in my BackupFiles folder is indeed empty.
 
Indeed. I don't know why Sara Ford felt the need to write that blog, because it serves no purpose to know that their is a backup folder that doesn't keep the backups. :LOL:
 
Looking closer, all folders in my BackupFiles folder is indeed empty.
That's because they are set to seven days by default John. I've changed mine to last the year.

Screenshot_142.jpg


I am assuming most of us haven't had a project crash on us within the last 7 days.
 
Back
Top Bottom