From 855fb52c65753fa391dc95de2beaebbf3223dfb1 Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Fri, 24 Apr 2020 03:26:20 +0530 Subject: [PATCH] Create csv directory if it doesn't exist --- fetchcsv.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fetchcsv.py b/fetchcsv.py index 2ba91f6..0c5cf69 100644 --- a/fetchcsv.py +++ b/fetchcsv.py @@ -24,6 +24,10 @@ def moveCSVfiles(): # todo: Find out why Twint doesn save to absolute path and remove the need for this step files = os.listdir(current_folder_path) destfolder = os.path.join(current_folder_path,csv_foldername) + + if not os.path.isdir(destfolder): + os.path.mkdir(destfolder) + for f in files: if (f.endswith('.csv')): shutil.move(os.path.join(current_folder_path,f), os.path.join(destfolder,f))