Skip to content

Commit

Permalink
Merge pull request #212 from evandroforks/clean-collection
Browse files Browse the repository at this point in the history
Set to remove old media directory before exporting it again to clean unused files
  • Loading branch information
aplaice authored Sep 15, 2024
2 parents bf9ae61 + 44fb8eb commit a441f96
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crowd_anki/export/anki_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def _save_changes(self, deck, is_export_child=False):
def _copy_media(self, deck, deck_directory):
media_directory = deck_directory.joinpath(MEDIA_SUBDIRECTORY_NAME)

shutil.rmtree(str(media_directory.resolve()), ignore_errors=True)
media_directory.mkdir(parents=True, exist_ok=True)

for file_src in deck.get_media_file_list():
Expand Down

0 comments on commit a441f96

Please sign in to comment.