From 07589d6c2bbcea908cd20a1469b32fff7cf0b8ea Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 5 Mar 2017 17:09:54 +0100 Subject: [PATCH] Now only deletes the files in trash --- folderCreator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/folderCreator.py b/folderCreator.py index 6b7a571..6211c8c 100755 --- a/folderCreator.py +++ b/folderCreator.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-03-05 13:52:45 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-03-05 17:07:44 +# @Last Modified time: 2017-03-05 17:09:29 import sqlite3, json, os, tweepy from re import sub @@ -99,7 +99,10 @@ def moveFiles(episode): os.rename(old_location, new_location) # shutil.rmtree(showDir + episode['original']) - os.remove(showDir + episode['original'] + '/*') + if episode['trash']: + for trash in episode['trash']: + os.remove(showDir + episode['original'] + trash) + os.rmdir(showDir + episode['original']) updateMovedStatus(episode)