Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else:
- print('Transferring File from FTP to 53 in chunks...')
- #upload file in chunks
- chunk_count = int(math.ceil(ftp_file_size / float(chunk_size)))
- multipart_upload = s3_connection.create_multipart_upload(Bucket = bucket_name, Key = s3_file_path)
- parts = []
- for i in range(chunk count):
- print('Transferring chunk {}...'.format(i + 1))
- part = transfer_chunk_from_ftp_to_s3(
- ftp_file,
- s3_connection,
- multipart_upload,
- bucket_name,
- ftp_file_path,
- s3_file_path,
- i + 1,
- chunksize
- )
- parts.append(part)
- print('Chunk .0. Transferred Successfully!'.format(i + 1))
- part_info = {
- 'Parts': parts
- }
- s3_connection.complete_multipart_upload(
- Bucket = bucket_name,
- Key = s3_file_path,
- UpLoadld = multipart_uploadUllploadIdl,
- MuLtipartUpLoad = part_info
- )
- print('All chunks Transferred to 53 bucket! File Transfer successful!')
- ftp_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement