Paths and Searching
Paths and Searching#
Convenience functions to find the database and other system locations without the user having to specify full paths.
- ankipandas.paths.find_db(search_paths=None, maxdepth=8, filename='collection.anki2', user=None, break_on_first=True) pathlib.Path #
Find path to anki2 database.
search_paths – Search path as string or pathlib object or list/iterable thereof. If None, some search paths are set by default.
maxdepth – Maximal search depth.
filename – Filename of the collection (default:
user – Username to which the collection belongs. If None, search for databases of any user.
break_on_first – Stop searching once a database is found. This is obviously faster, but you will not get any errors if there are multiple databases matching your criteria.
If none or more than one result is found –
Path to the anki2 database
- ankipandas.paths.db_path_input(path: str | PurePath | None = None, user: str = None) Path #
Helper function to interpret user input of path to database.
If no path is given, we search through some default locations
If path points to a file: Take that file
If path points to a directory: Search in that directory
- ankipandas.paths.get_anki_backup_folder(path: str | PurePath, nexist='raise') Path #
Return path to Anki backup folder.
path – Path to Aki database as
nexist – What to do if backup folder doesn’t seem to exist:
Path to Anki backup folder as
- ankipandas.paths.backup_db(db_path: str | PurePath, backup_folder: str | PurePath | None = None) Path #
Back up database file.
db_path – Path to database
backup_folder – Path to backup folder. If None is given, the backup is created in the Anki backup directory.
Path to newly created backup file as