0

I am copying folder to S3 with s3fs.put(..., recursive=True) and I experience weird behavior. The code is:

import s3fs    

source_path = 'foo/bar'                # there are some <files and subfolders> inside
target_path = 'S3://my_bucket/baz'

s3 = s3fs.S3FileSystem(anon=False)
s3.put(source_path, target_path, recursive=True)

First time I run the command (files and S3 "folders" are created), results end up like this:

S3://my_bucket/baz/<files and subfolders>

Second time I run the command, the result looks like this

S3://my_bucket/baz/bar/<files and subfolders>

I can probably check existence of the "folders" before, but that does not solve the problem that I do not want to see bar in the resulting tree structure. I tried to append '/' to target_path in line with the documentation, but it did not have any effect. Is there a way to force s3fs behave same way regardless of existing data in S3?

Andrew Gaul
  • 2,296
  • 1
  • 12
  • 19
Pepacz
  • 881
  • 3
  • 9
  • 24

0 Answers0