Changing File Location

Hi. I’ve used Anki for years. But I want to change the location of my “collection.media” files. I looked up the manual and it said to place -b “C:\collection.media” in the Shortcut (Windows 10: right-click properties, shortcut tab, add this to the end of the “target” line, so altogether it reads “C:\Program Files\Anki\anki.exe” -b “C:\collection.media”). I did this, and then copied my collection.media folder to that location. Then I started Anki. It seemed to work, in that my media files played. But then I thought I’d better test that it was actually accessing files from the new location, so I temporarily renamed my old collection.media folder to see if it was working from the new location. It doesn’t appear to have worked, because when I restarted Anki, it immediately created a brand new collection.media folder in the old standard location (which immediately looked like a red flag to me), then started synching, and the synching log said “removed” files! And my media sound files didn’t play. I Aborted immediately because I definitely don’t want to loose 5 years of slowly and carefully accumulated files! I changed it back and the synching seemed to reverse it, thank goodness! (“Added” instead of “Removed”)

Does this actually work? The instructions in the manual seem fairly clear and I’m fairly sure I followed them correctly, and it seems doubtful that the instructions would be still there in the manual if they were wrong.

Is this the right way to go about it? Am I missing something?

In case it matters, I am using an older version of Anki, but it’s still Anki 2 (I use the Korean Support add-on, and didn’t update because it’s quite difficult to get this particular add-on updated, and I worried that the add-on might not work in the new version)
Version ⁨2.1.45 (355e66e8)⁩
Python 3.8.6 Qt 5.14.2 PyQt 5.14.2

Thanks in advance!

-b changes the base folder, not the profile media folder, so the name you’ve chosen is not ideal - you should call it something like c:\ankidata instead. If files/folders were created in the original location, that seems to imply Anki was run without that -b argument though.

Thank you for the reply. I’m sorry if this is a stupid question, but I’m, by no means a computer expert. By “base folder”, do you mean I should copy the entire program folder and contents, “Anki2”? That’s the folder that’s in my “roaming” folder, and not only the media.collections folder. My whole folder setup is (I always install standard, as per wherever Anki wanted to put it at the time) “C:/Users/MyPC/AppData/Roaming/Anki2/User 1/collection.media”. Which folder should I be copying/moving to my desired new location?

I definitely had -b “C:\collection.media” pasted. Did I have it pasted in the correct place? I just right-clicked the shortcut icon on my desktop, clicked the properties menu at the bottom, went to the ‘shortcut’ tab, and in the field labelled “target” I pasted -b “C:\collection.media”, so that the entire line read, “C:\Program Files\Anki\anki.exe” -b “C:\collection.media” (I’ll change the “collection.media” name). Is that correct? I actually copied and pasted this from that field when I wrote the question.

Thanks again for your help.

The base folder is “C:/Users/MyPC/AppData/Roaming/Anki2 by default. If you change the command to -b c:/ankidata and start Anki, you can confirm it’s working by checking to see if that folder was automatically created.

This is still not working. I left-clicked the “properties” shortcut on my desktop, navigated to the “shortcut” tab and changed the “target” field to:
“C:\Program Files\Anki\anki.exe” -b “C:\AnkiDataFolder”
and it didn’t create a new folder in the new position at all. So I copied the old one (everything under “Anki2”) to the new position, “C:\AnkiDataFolder” (renaming Anki2 to AnkiDataFolder), and renamed the old one to something different to confirm it wasn’t using it any longer. Anki just didn’t find the new folder at all and went ahead and pretended that it was a brand new install, creating it’s own brand new Anki2 folder in the old position and asking me for my language. It obviously didn’t even look for the new folder. It starts fine only if it can use the old folder in the default position. Is there something wrong with the line in the manual? I’m using it exactly the way the manual states to use it, as above. In fact, I actually even copied and pasted the whole line into my shortcut to be sure.

What is the problem? It looks to me like this shortcut solution just does not work.

I just tested it with Anki 2.1.45 and it works for me.

Target: "C:\Program Files\Anki\anki.exe" -b c:\ankidata

And if I run this line in the debug console, it’ll say c:\ankidata.

print(mw.pm.base)

https://docs.ankiweb.net/misc.html#debug-console

image

I tested with 2.1.65 and -b "c:\ankidata" it worked for me too. I’m afraid I’m not sure why it’s not working for you.

I tried it again. Here are snips of my windows:
image
The window I get when I start up Anki after the changes.


My shortcut window - same as yours. And I am asked to change this as an administrator.


I COPIED the files to here to try to help it, but it isn’t looking here at all.


The brand new files it makes when it can’t find my renamed files.

The only difference is that I’d like the files on D: Although, just to check in case it just wasn’t happy with another drive other than the main drive, I tested C: also, and it still doesn’t work. Is there something you can see that I’m doing wrong, because it looks exactly right to me. Is it possible that there is some small corruption in my Anki program files or something? I have several other small QOL add-ons, but I doubt they’d be interfering with this, would they? Is there any way to test the integrity of my program files, other than reinstalling?

I guess I could try updating Anki, but the reason I haven’t is because I have the Korean Support add-on, which tends to be a little finicky and which hasn’t been updated in a few years, and I’m skeptical as to whether it would work on the new version, and unless I’m sure, I don’t want to take the risk, because Anki for me is utterly useless without that Korean Support, and I’ll lose everything if it doesn’t work, and Anki contains all my personal dictionary and records. Korean is the language I learn, and I can’t learn Korean on Anki without it. There are messages on the add-on site from people who say it works dated later than the Anki update, but are they using the later version? I don’t know.

If there’s anything else I can show you to help pinpoint the problem, please let me know. I need to move these files.

It looks like it worked and Anki started from the D:\ankidata folder. Since the folder didn’t exist (and ‘prefs21.db’ couldn’t be found), Anki will also ask for the interface language (1st screenshot) and will also create a new ‘User 1’ profile (3rd screenshot) with the empty collection.media folder (as a subfolder).

If you run this line in the debug console, you can double-check that Anki is indeed running with D:\ankidata as its base folder (or use Tools > Add-ons > View Files to view the addons21 folder and its location with the Explorer).

print(mw.pm.base)

https://docs.ankiweb.net/misc.html#debug-console

Another way to “move” the collection.media folder, is to open Anki as usual (your main Anki profile with cards), use File > Export to export your collection with media and scheduling, close Anki, open Anki with the shortcut in a new base folder (using the ‘-b’ key) and use File > Import to import your collection with media and scheduling.

https://docs.ankiweb.net/exporting.html?highlight=ex#collection-colpkg

Hi,

I actually installed Anki on my work PC (I work in South Korea, hence the strange language in the clip. It STILL doesn’t work even on a fresh install (Qt6). There must be something I’m doing wrong. @kelciour - this is the file window that opens when I go to add-ons and “install from file”. (I have no idea how to open the debug console).

And below you can clearly see what happens when I start Anki. If I rename the original Anki files it simply doesn’t find them and creates a new set in the OLD location. This has to be wrong, as I originally said. I want it to create the new set of files in the NEW location, right?

It is DEFINITELY looking in the wrong place, as the fresh creation of the new files in the OLD place suggest. I’m not a computer nerd, just a common user who can follow instructions, trying to learn a language. I feel like I’m following all the instructions correctly, but if you guys are getting it to work, there must be something different in my case. I gave you the step by step things that I did in my first two posts. Is there something that I am not doing right? Something that is taken for granted by more knowledgeable people that I don’t get? The only other thing I can think of that might be different with my install to someone else’s is my add-ons, surely they aren’t interfering are they? Just in case, here is a clip of those, too.

And here is my shortcut field once again (sorry about the Korean - you can still see the English shortcut identifiers):

I’ve gone over it and over it and I’m at a loss. I’m just meant to past that “-b “C:\AnkiDataFolder”” into the shortcut, just like I did right? Anki is supposed to do the rest, is it? Supposedly, Anki will create new base files in the new location for me, right? Is that how it’s supposed to work? With this -b line pasted into Anki, Anki is supposed to look there, right? Anki isn’t looking there at all - it’s as if Anki isn’t seeing that -b line pasted into the shortcut at all. Is the spacing right? I just copied and pasted it from the manual.

Thanks in advance.

Add-ons shouldn’t affect this, as it’s early in the startup process.

I can’t see anything you’re obviously doing wrong, and am not sure why it’s not working. Have you confirmed it’s broken with the latest Anki version? The only other thing I can think of that you could try is opening cmd.exe, using ‘cd \path\to\anki’, and then ‘anki -b d:\ankidata’ to start Anki directly from cmd.exe.

Yes, try with cmd.exe (Command Prompt).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.