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

Feature request - Check if file exists without ls or downloading the entire object #682

Closed
yitzhaklevi opened this issue Nov 30, 2023 · 0 comments · Fixed by #730
Closed
Assignees

Comments

@yitzhaklevi
Copy link

Is it possible to check if object exists without downloading it entirely or applying ls (which requires ListObjects)
It can be implemented using - https://github.com/peak/s5cmd/blob/master/storage/s3.go#L118
Usage can be by having another op or simply --metadata_only flag for cp

Thanks !

@ilkinulas ilkinulas added this to s5cmd Jun 30, 2024
@ilkinulas ilkinulas moved this to In Progress in s5cmd Jul 2, 2024
@ilkinulas ilkinulas moved this from In Progress to Review in s5cmd Jul 5, 2024
ilkinulas pushed a commit that referenced this issue Jul 26, 2024
This pull request adds the `head` command to the program. Closes #682.

The `head` command is designed to check if a file exists without
downloading the object or bucket itself. It retrieves metadata from an
object without returning the object itself. This operation is useful for
users who are only interested in an object's metadata.

- Implemented the head command functionality.
- Added end-point tests to ensure the correctness of the head command
implementation.

Usage:

Check if a bucket exists
```
s5cmd head s3://bucket-name
```

Check if a file exists and retrieve its metadata

```
s5cmd head s3://bucket-name/object
```

---------

Co-authored-by: S.Burak Yaşar <[email protected]>
@github-project-automation github-project-automation bot moved this from Review to Done in s5cmd Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants