Create csv directory if it doesn't exist

This commit is contained in:
Vivek Teega 2020-04-24 03:26:20 +05:30 committed by GitHub
parent dacfdaeef6
commit 855fb52c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))