Media files disappeared after restoring from AnkiWeb

Hi,

I’m hoping someone can help me understand whether there is any chance of recovering my missing media files.

I use Anki on both my computer and my phone, and my collection is synced with AnkiWeb. I have many decks, including several large ones with a few gigabytes of media.

On my computer, I temporarily deleted a couple of those large decks because I wanted to experiment with some other decks. I did not sync after deleting them, so I assumed the original decks and their media were still safely stored on AnkiWeb. I also removed trashed media, so I could have free space on my hard drive.

The experiment did not work out, so I restored a backup. After that, Anki asked me which version I wanted to keep during synchronization. I chose “Download from AnkiWeb,” because the deletion had never been synced and I expected the server version to restore everything.

The decks and cards seem to have been restored, but I later noticed that the media files belonging to the deleted decks were missing.

I then opened Anki on my phone, where the media files were still present, hoping that the mobile version might help me recover them. Unfortunately, as soon as synchronization started, Anki also began deleting those media files from the phone.

After discussing the situation with ChatGPT, I think I understand that I made a mistake by assuming that downloading the collection from AnkiWeb would also restore or overwrite the media state. Apparently, collection syncing and media syncing are handled separately, so the media deletion may have been synchronized even though I downloaded the collection from the server.

ChatGPT also told me that there may be a chance that recently deleted media can be recovered from an AnkiWeb backup, and suggested that I create a topic here as soon as possible.

Is there any possibility of recovering these media files from the server? I have stopped syncing for now.

Please let me know what information would be needed from me. Don’t know how the interface may look like, but if possible, I’d like to restore version saved before this day (ie, 13 july)

Thank you.

Yes, that’s correct.

[What you could have done to avoid syncing the media deletions to AnkiWeb is log out in Preferences > Syncing. When you clicked Sync and log in again, AnkiWeb would do a full rescan of your media. Because you were out of sync – missing files on one end, but not the other – those files would have been restored instead of deleted.]

In the future, when you want to experiment with a deck, create another profile in desktop Anki – Profiles - Anki Manual . That profile won’t sync with your AnkiWeb account, so it will protect you real collection from harm.

Just to be clear – if the media files were already in media.trash, then those files were already not synced with the server. So, did you just Empty Trash? Or did you first Delete Unused Media, to delete the media for those temporarily-deleted decks from your collection?


Those questions and advice aside – yes, I can restore recently deleted media on the server side, so you should be able to re-download those files.

Can you confirm that the email address you used to post here is the same one for your AnkiWeb account?

If so, I can see that there are 10K+ files deleted in the past day. I can start by restoring those, and then we can see if there are any more. That’s good that you’ve already stopped syncing. The restore can take up to an hour, and I’ll let you know when it is starting and when it is completed.

Please confirm if you are ready for me to proceed with restoring those files.

Just to be clear – if the media files were already in media.trash, then those files were already not synced with the server. So, did you just Empty Trash? Or did you first Delete Unused Media, to delete the media for those temporarily-deleted decks from your collection?

First of all, I deleted the deck. Then deleted unused media. And finally emptied trash. And then I installed those experimental decks. To be fair, I liked them, but their weight (+6 Gb) apparently made my collection unsynchronizable.

In the future, when you want to experiment with a deck, create another profile in desktop Anki – Profiles - Anki Manual . That profile won’t sync with your AnkiWeb account, so it will protect you real collection from harm.

I think, I did that as well. But main issue is these decks made my collection is too large and anki denied me from synchronization. So, I decided to make backup, which was unsuccessful ((

Please confirm if you are ready for me to proceed with restoring those files.

Yes, I confirm this. And I have additional question. After restoration, what’s the correct sequence of events? I mean, should I start with something specific? Or I will just synchronize my ankidroid and desktop version with ankiweb and download collection FROM ankiweb?

I’m starting the restoration now. I’ll give you the steps for after once it’s complete.

The files have been restored. It was nearly 70K files – about 9 GB of additional media. [I checked another day into the past beyond that, and there were no more deleted files.]

It will start downloading on your next sync. I recommend getting that all synced to desktop first – and it’s likely to take several tries to sync all of it. Then you can sync your AnkiDroid until it has all of it. There’s no one-way/direction for Media Sync, so AnkiWeb and both your devices will end up with all of the media.

Once all of your devices are fully synced, you should go through the Check Media process on one device to delete the media you don’t actually need (like media from those decks you were experimenting with, and media leftover from old decks you’ve deleted). Then you can sync those deletions to AnkiWeb, and then sync those deletions to your other device. You can’t start cleaning up the media until your devices are fully synced. If you do, syncing will probably restore those deleted files, and you’ll just have to delete them again.

Thank you very much for restoring the files and for explaining the correct order of syncing and cleaning them up. I’ll make sure to fully sync everything to the desktop first, then sync AnkiDroid, and only after that use Check Media to remove the files I no longer need.

I’m still a little confused about where all 70,000 files and 9 GB came from. The decks I removed to prepare space for experimental deck had several gigabytes of media, but I don’t think they contained anywhere near 70,000 files and weighted 9GB.

What confuses me is that when I tried to sync after importing that large experimental deck, Anki showed a message saying that synchronization was not possible because the collection was too large. Because of that, I assumed that neither that deck nor its media had been uploaded to AnkiWeb.

What was the reason? Is it possible that despite that message, while some or all of the media files from that same deck were still uploaded separately through Media Sync?

Also, when you say that you restored all deleted files from that period, does that include media from that experimental deck, as well as other old or unused media that were no longer referenced by any cards?

I’m asking mainly so I can better understand what happened before I start removing the unnecessary files with Check Media.

Prior to all of this kicking up last week, when was the last time you’d cleaned up your unused media? Anki is a stickler about holding on to media until you explicitly release it, so unused media can hang around for a long time

The best way to tell where that media came from is to look at it. When you run Check Media, you get a list of the files that aren’t used. Perhaps some of them will have meaningful filenames, and you can skim the list for those. But you can also open your collection.media folder [click View Files], and look at/listen to/watch some of those files from the list to figure out what they are.

If you’re nervous about deleting them – don’t be.

  1. The only way files get on that list is by not being referenced anywhere in your collection – at least not in a standard way. [You can check that too – just search for any of the filenames in Browse to see they aren’t in any of your notes.] If they aren’t used normally in your collection (and you aren’t using them in any unusual ways), then you aren’t going to miss them.
  2. Remember that the deletion is a 2 step process, and you can keep them around on your device (in media.trash) as long as you want – until you’re sure it’s safe to delete them permanently.

That “oversize” syncing error only considers the size of the collection database, not the media – Are there limits on file sizes on AnkiWeb? - Anki FAQs . As you discovered already, media sync is separate from collection sync. So yes, that’s likely what happened.

The restoration doesn’t consider why the files were there. It only considers what date they were marked as deleted (since they are only recoverable server-side for a limited time). So yes, the restored set of files can include files you need as well as files you don’t need.