Przeglądaj źródła

210803 skip renaming directories

yukyo0821 3 lat temu
rodzic
commit
84b6bd9477
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      models/contents/routes.py

+ 5 - 2
models/contents/routes.py

@@ -5,6 +5,7 @@ from os import path, remove, walk, mkdir
 import logging
 import re
 from models.config import CONTENT_DIR, STATIC_DIR
+import shutil
 
 
 contents_app = Blueprint('contents', __name__)
@@ -135,8 +136,10 @@ class Content(Resource):
         content_data = list(self._search_content())
         file_dir = content_data[0].get('path')
         if path.exists(file_dir):
-            remove(file_dir)
-            logger.info('delete file: {}'.format(file_dir))
+            #remove(file_dir)
+            shutil.rmtree(file_dir[0:file_dir.replace('\\','/').rfind('/')+1])
+            #print(file_dir[0:file_dir.replace('\\','/').rfind('/')+1])
+            logger.info('delete dir: {}'.format(file_dir[0:file_dir.replace('\\','/').rfind('/')+1]))
         else:
             logger.warning('delete fail with {} not exist'.format(file_dir))