Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glob: difference between CloudPath and Paths #154

Closed
remi-braun opened this issue Jul 27, 2021 · 0 comments · Fixed by #202
Closed

glob: difference between CloudPath and Paths #154

remi-braun opened this issue Jul 27, 2021 · 0 comments · Fixed by #202

Comments

@remi-braun
Copy link

Hello,

I have a replicated filetree between my S3 compatible storage and a local filesystem.
However, there is a discrepency when I use the glob function.
The filesystem glob works fine, but I have to add "**/*/" at the beginning of the path for CloudPath's glob

# Composition of the bucket (sorry for the long names)
# NB: there are duplicates with and without /, may be related to #148
>> list(cloud_path.glob("**/*"))
[S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS/'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS/20191215T110441_S2_T30TXP_L2A_122756/'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS/20191215T110441_S2_T30TXP_L2A_122756'), 
S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS/20191215T110441_S2_T30TXP_L2A_122756/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif')]

# Not working ways of retrieving the file 14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif
>> list(cloud_path.glob("DAX/BY_PRODUCTS/*/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif"))
[]
/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif')]
>> list(cloud_path.glob("**/DAX/BY_PRODUCTS/*/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif"))
[]
>> list(cloud_path.glob("*DAX/BY_PRODUCTS/*/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif"))
[]

# Correct way
>> list(cloud_path.glob("**/*DAX/BY_PRODUCTS/*/14_20191215T110441_S2_T30TXP_L2A_122756_CLIP.tif"))
[S3Path('s3://my_bucket/MODULES/PROCESS/CLIPPING/DAX/BY_PRODUCTS/20191215T110441_S2_T30TXP_L2A_122756]

Note: I am still on my Ceph compatible storage (see #148), I hope this is not related 😓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant