33# s3copy.py 
44# It is an example that handles S3 buckets on AWS. 
55# It uses Resource API (high-level) of Boto3. 
6- # Copy a  object from a S3 bucket to another S3 bucket. 
6+ # Copy an  object from a S3 bucket to another S3 bucket. 
77# You must provide 3 parameters: 
88# SOURCE_BUCKET = Source bucket name 
9- # SOURCE_FILE   = Source file name 
9+ # SOURCE_OBJECT  = Source file name 
1010# DESTINATION_BUCKET = Destination bucket name 
1111
1212import  sys 
@@ -19,17 +19,17 @@ def main():
1919 # which is the script itself. 
2020 args  =  sys .argv [1 :]
2121 if  len (args ) <  3 :
22-  print ('Not enough parameters. Proper  Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_FILE > <DESTINATION_BUCKET>' )
22+  print ('Not enough parameters.\n Proper  Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_OBJECT > <DESTINATION_BUCKET>' )
2323 sys .exit (1 )
2424
2525 source_bucket_name  =  args [0 ]
2626 source_key  =  args [1 ]
2727 destination_bucket_name  =  args [2 ]
2828 destination_key  =  source_key 
2929 print ('From - bucket: '  +  source_bucket_name )
30-  print ('From - file:   '  +  source_key )
30+  print ('From - object:  '  +  source_key )
3131 print ('To - bucket: '  +  destination_bucket_name )
32-  print ('To - file:   '  +  destination_key )
32+  print ('To - object:  '  +  destination_key )
3333
3434 # Instantiate the service resource object 
3535 s3resource  =  boto3 .resource ('s3' )
@@ -44,7 +44,7 @@ def main():
4444 'Key' : source_key 
4545 }
4646 dest_bucket .copy (copy_source , destination_key )
47-  print ('\n Copied ' )
47+  print ('Copied ' )
4848 except  botocore .exceptions .ClientError  as  e :
4949 if  e .response ['Error' ]['Code' ] ==  "404" :
5050 print ("Error: Not Found, problem with the parameters!!" )
0 commit comments