mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-23 10:20:13 +00:00
handle edge cases in migration clean up
This commit is contained in:
parent
6f915a5733
commit
ab8fed14bb
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from home.src.es.connect import ElasticWrap, IndexPaginate
|
from home.src.es.connect import ElasticWrap, IndexPaginate
|
||||||
@ -167,5 +168,8 @@ class FolderMigration:
|
|||||||
all_folders = ignore_filelist(os.listdir(self.videos))
|
all_folders = ignore_filelist(os.listdir(self.videos))
|
||||||
for folder in all_folders:
|
for folder in all_folders:
|
||||||
folder_path = os.path.join(self.videos, folder)
|
folder_path = os.path.join(self.videos, folder)
|
||||||
|
if not os.path.isdir(folder_path):
|
||||||
|
continue
|
||||||
|
|
||||||
if not ignore_filelist(os.listdir(folder_path)):
|
if not ignore_filelist(os.listdir(folder_path)):
|
||||||
os.rmdir(folder_path)
|
shutil.rmtree(folder_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user