s5cmd icon indicating copy to clipboard operation
s5cmd copied to clipboard

ls yields both relative and absolute paths in the same request

Open ewjoachim opened this issue 1 year ago • 0 comments
trafficstars

Thanks for the project <3

If I do:

$ touch foo
$ s5cmd cp foo s3://mybucket/a/b/c/foo
$ s5cmd cp foo s3://mybucket/a/b/c/foo/bar
$ s5cmd cp foo s3://mybucket/a/b/c/foobar

I'll get:

$ s5cmd ls s3://mybucket/a/b/c/foo
                                  DIR  foo/
2024/09/04 13:53:58                 0  a/b/c/foo
2024/09/04 13:54:39                 0  foobar

For some reason, while foo/ and foobar are shown with their relative path, foo's absolute path is shown. This makes automated processing of the output much harder.

[!NOTE] The behavior is the same if there's no file/folder ambiguity. If I only upload a single file, I get the same result: if I request ls <somepath>, and there is a file for which the path is exactly somepath, I'll get its absolute path, otherwise I'll get its relative path.

Fortunately, adding a wildcard makes the output much saner. (thankfully, I'm ok with recursive listing)

$ s5cmd ls s3://com.botify.saas.sandbox18.user.data/test/a/b/c/foo'*'

2024/09/04 13:53:58                 0  foo
2024/09/04 13:54:58                 0  foo/bar
2024/09/04 13:54:39                 0  foobar
$ s5cmd version  
v2.2.2-48f7e59

(by the way, it would be much easier to process if there was an option to get the fullname that didn't remove the size and mdate)

ewjoachim avatar Sep 04 '24 14:09 ewjoachim