I’m organizing the images into folders within the media folder, but the images are not syncing on iOS. What’s the problem?
Subfolders inside collection.media
are not synced. Everything that you want Anki to see should be at the top level of that folder.
Thank you for the reply!
There’s no way of changing it, right?
I will make a other folder and I guess that I will sync it through a python script. More work, but it’ll do the same function.
No way to change it, but also no reason you’d need to. You should think of collection.media
as belonging to Anki – it adds files to the folder when they are attached to notes, and it doesn’t have trouble finding them later.
If you plan to add files externally, make sure you use Tools > Check Media liberally. Media - Anki Manual
I have a field called “source” and I what I was thinking was converting PDFs to images and use them as references while organized in subfolders in the media folder. What I did was to make a folder and mirror some files on the top level. It’s working, but it’s not the ideal.
You can see in the link to the manual I already posted the primary reason why Anki might need to rename files. The other common reason is that Anki needs to protect an existing file if you attach a different file with the same name.
Is there no way of preventing this? Like naming in a certain way that prevents this?
What file deals with it in Anki’s code?
EDIT: It appears that the syntax required by the Check Media is definined in the Rust part of anki? If yes, what file exactly?
Yes, if you give each unique file a unique name, then Anki doesn’t need to change them.
You’re on your own with that one. But what Anki is doing is protecting your files, so I can’t see why you’d want to change it. The name given to any particular file in the collection doesn’t matter – the only thing that matters is that the name used in the notes and the name of the file match.
I found the file I guess, it’s the files.rs. I guess that I understood in what conditions it change the name of the file.
I was worried about this because I created an image, and Anki changed its name when checking the media. In this case, I wanted the images to follow a specific pattern for easier organization withou the risk of Anki changing it, especially when editing (I create the flashcards directly using HTML).
Thank you very much for the replies!
Files will get renamed if the filenames are too long, or the encoding of things like accented characters is not in the format Anki expects.
What I did is a script that verifies all the files before importing to ensure that the characters are only ASCII and not too long (less than 120).
But, one doubt, how much difficult would be to permit subfolders on Anki’s folder?
It appears that it would be only a problem with synching, and all would be need is that the subfolders creation doesn’t exceed 120 characters.
It’s good to have some direct media management, because when you create cards and import decks, it’s very easy to turn it a bunch os things there, and you don’t have a quick glance of what pertains to what.
Subfolders make syncing more complicated, since now you have to deal with cases where there’s a folder ‘foo’ on device 1, and file ‘foo’ on device 2, which is going to conflict. There are also total path length limits that subfolders are more likely to butt up against.
I guess you could make rules in Anki’s manual that a careful reader would avoid to break, and apply the same rules that you do nowadays for files for incompatibility. And if there’s incompatibility, just return a error with the synch - the careful reader would know why it happened.
I mean, it’s not everyone that willl make what I did. It’s a special case where someone wants to “organize” the media.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.