From 5ff6f18db0d493b7cc34d405ac5359aec266156a Mon Sep 17 00:00:00 2001 From: James McManus Date: Fri, 7 Jul 2023 17:30:35 -0400 Subject: [PATCH] added filename to findDir path when shutil.move --- kalpana/kalpana.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kalpana/kalpana.py b/kalpana/kalpana.py index ec4310f..8e33f81 100644 --- a/kalpana/kalpana.py +++ b/kalpana/kalpana.py @@ -257,9 +257,10 @@ def main(args): # move cog tiff to final directory finalPathFile = glob.glob(outputDir+'*_epsg4326.tif')[0] + finalFile = finalPathFile.split('/')[-1] logger.info('The length of the finalPathFile is: '+str(len(finalPathFile))) try: - shutil.move(finalPathFile, finalDir) + shutil.move(finalPathFile, os.path.join(finalDir, finalFile)) logger.info('Moved cog file '+finalPathFile+' to '+finalDir+' directory.') shutil.rmtree('/data/'+modelRunID+'/kalpana', ignore_errors=True) logger.info('Removed TIFF file /data/'+modelRunID+'/kalpana.') @@ -385,7 +386,7 @@ def main(args): finalFile = finalPathFile.split('/')[-1] try: - shutil.move(finalPathFile, finalDir+finalFile) + shutil.move(finalPathFile, os.path.join(finalDir, finalFile)) logger.info('Created cog file '+finalPathFile+' and move to '+finalDir+' directory.') except OSError as err: logger.error(err)