Rename partially downloaded images

This commit is contained in:
Tanner Collin 2021-03-07 22:49:10 -07:00
parent 612f47d551
commit b213f4cb18

View File

@ -18,10 +18,12 @@ def download(ip, dest):
for f in files: for f in files:
source_file = '/3dscan/' + f source_file = '/3dscan/' + f
dest_file = dest / f dest_file = dest / (f + '.tmp')
print('Grabbing file', source_file) print('Grabbing file', source_file)
sftp.get(source_file, dest_file) sftp.get(source_file, dest_file)
sftp.remove(source_file) sftp.remove(source_file)
done_file = dest / f
dest_file.rename(done_file)
if sftp: sftp.close() if sftp: sftp.close()
if transport: transport.close() if transport: transport.close()