fixed jpgs including pdf in filename

This commit is contained in:
Dan Dembinski
2021-06-16 10:25:49 -04:00
parent 833a753d3c
commit 050d936f2b

View File

@@ -1,8 +1,9 @@
import pdf2image, shutil, sys, os, logging import pdf2image, shutil, sys, os, logging
file = sys.argv[1] file = sys.argv[1]
outfile = os.path.basename(file) outfile = os.path.splitext(os.path.basename(file))[0]
outputPath = 'C:\\Images\\IDV2ICP\\' #outputPath = 'C:\\Images\\IDV2ICP\\'
outputPath = 'C:\\Users\\ddembinski\\Desktop\\FOMO\\'
uploadPath = os.path.dirname(file) uploadPath = os.path.dirname(file)
logging.basicConfig(filename='ICPThumbnails.log', format='%(asctime)s - %(message)s', logging.basicConfig(filename='ICPThumbnails.log', format='%(asctime)s - %(message)s',
@@ -35,7 +36,7 @@ try:
if not os.path.isdir(uploadPath + '\\Archive'): if not os.path.isdir(uploadPath + '\\Archive'):
os.mkdir(uploadPath + '\\Archive') os.mkdir(uploadPath + '\\Archive')
shutil.move(file, uploadPath + '\\Archive\\' + str(outfile)) shutil.move(file, uploadPath + '\\Archive\\' + str(outfile) + '.pdf')
logging.info('%s - Converted' % (file)) logging.info('%s - Converted' % (file))
@@ -43,4 +44,4 @@ except Exception as e:
logging.info('%s - conversion failed' % (file)) logging.info('%s - conversion failed' % (file))
if not os.path.isdir(uploadPath + '\\Exception'): if not os.path.isdir(uploadPath + '\\Exception'):
os.mkdir(uploadPath + '\\Exception') os.mkdir(uploadPath + '\\Exception')
shutil.move(file, uploadPath + '\\Exception\\' + str(outfile)) shutil.move(file, uploadPath + '\\Exception\\' + str(outfile) + '.pdf')