File Recovery

Long Story but I did a fresh install of Kubuntu on my system, but before I did I forgot to save the files that housed my email from the kMail program. Any chance those file might still be on my drive somewhere. I’ve read and attempted a couple of file recovery suggestions but to no avail. Thanks.

Most email accounts nowadays are IMAP. If you had an IMAP email account then all your messages should still be there on your email provider’s sever. Log in and check.

Prior to this re-installation incident I had been attempting to migrate my email folders from gmail to my desktop using kmail to sync with gmail and store old messages on my local device. So I had recreated the folders on in kmail on “my local computer” and moved emails from the folders I had in gmail to the folders I created in the “my local computer” section. When I moved the emails to the new location they “deleted” them from my gmail account. When you say to log into my IMAP account I’m guessing this is just my gmail which I have and all of the folders are gone, unless there is some secret restore gmail history thing I haven’t thought of. I forget the folder location that kmail uses for the local email but it must be somewhere on my hard drive if the installation didn’t wipe it and and there is any way to recover data from the drive. What am I missing? Is there a work around? File recovery?

Ah! I don’t use any Google products so I don’t know much about how Gmail functions but I would take a look at the trash folder in Gmail nonetheless since many IMAP providers place deleted items in a trash folder and then purge that folder periodically. So, if that’s how Gmail does it then you might still find your deleted emails there.

Regarding attempting to locate your local folder where kmail may have stored your messages, use a content indexer such as mlocate. You can install it via apt:

sudo apt install mlocate

Once it has indexed your drive you can use the locate command to find files and directories on your system.

Also, I suggest that you don’t try and keep your emails local to a single computer. There is no advantage to doing that; only disadvantages. :slightly_smiling_face:

See this article for how to use mlocate.

Thanks for the support. It was an interesting journey and my number 1 lesson is to file map my local email directory to a location that will remind me to back it up when I change distros.

In following up, I finally found photorec which ran through my drive to dig up any files with the mail extension .mbox. However, there were so many files that after reviewing as many as I could I decided to cut my loses and move on. I have been trying to escape my google dependancy for some time so this was perhaps a “happy accident.” Thanks again for your assistance and ideas, it lead me to some great learning and many rabbit holes.