I am using Anki both on my desktop and mobile.
I created a long deck on desktop by hand and ran sync. It asked me whether I want to download or upload, and I selected to download. I didn't think it would delete the existing deck just because it is absent on server, but it did just that.
Is it possible to restore it?
2 Answers
The other answer is about Linux system, but in macOS, the backup directory is located in the following path:
~/Library/Application Support/Anki2/Username/backups Yes, Anki does automatic backups you can recover from
Anki Mobile Backup Restoration
The mobile client does automatic backups of collections in the background, which you can restore by going to Preferences → Backups and select the backup you want to use.
AnkiMobile will automatically create backups of your collection for you. The backups include all your cards and statistics, but do not include sounds or images, since they take up a lot of space.
The backup is taken in the background when you return to your device’s home screen, or switch to another app. A backup will only happen if more than an hour has elapsed since the last time a backup was created. AnkiMobile will store the last 15 backups.
To restore from a backup, open the Backups section in the preferences, and tap on the backup you wish to restore to.
From the Anki manual, in the 'Backups' section.
Anki Desktop
In my Anki directory, I have a backups entry with backups present:
(backup listing, not all entries shown)
So check in ~/.local/share/Anki/<profilename>/backups.