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

[CLI] Command line to delete files on a repo #2235

Open
Wauplin opened this issue Apr 18, 2024 · 5 comments · May be fixed by #2280
Open

[CLI] Command line to delete files on a repo #2235

Wauplin opened this issue Apr 18, 2024 · 5 comments · May be fixed by #2280
Labels
CLI good first issue Good for newcomers

Comments

@Wauplin
Copy link
Contributor

Wauplin commented Apr 18, 2024

At the moment it's not possible to delete remote files from the command line except using the huggingface-cli upload (...) --delete="*" command. But this one requires to upload while deleting.

Other feature request: CLI command to move files inside a repo.

We have everything needed in HfApi, it's just a matter of implementing the CLI.

Requested by @ArthurZucker "feature request for clumsy people" 😄

@Wauplin Wauplin added the CLI label Apr 18, 2024
@OlivierKessler01
Copy link

Hi @Wauplin :)

Is that something I could take as a first contribution ?

I see we have two related functions in the HfApi, namely delete_file and delete_folder. Should we rather have a single or two commands ? In the former, should we use a similar API to upload --delete="*" and use a glob-type parameter ?

@Wauplin
Copy link
Contributor Author

Wauplin commented May 2, 2024

Hi @OlivierKessler01, thanks for proposing your help on this issue :)

Agree with you it makes sense to create a single command. I would maybe call it huggingface-cli repo-files delete <repo_id> <file> (and after that huggingface-cli repo-files move). Something like this:

# delete all
huggingface-cli repo-files <repo_id> delete *

# delete single file
huggingface-cli repo-files <repo_id> delete file.txt

# delete single folder
huggingface-cli repo-files <repo_id> delete folder/

# delete multiple
huggingface-cli repo-files <repo_id> delete file.txt folder/ file2.txt

# delete multiple patterns
huggingface-cli repo-files <repo_id> delete file.txt *.json folder/*.parquet

# delete from different revision / repo-type
huggingface-cli repo-files <repo_id> delete file.txt --revision=... --repo-type=dataset

What do you think?

EDIT: updated the snippet above with new format based on offline discussion with @julien-c

@Wauplin Wauplin added the good first issue Good for newcomers label May 2, 2024
@OlivierKessler01
Copy link

Hi @Wauplin thank you for the thorough answer :)

I'll be working on this next week.

@Wauplin
Copy link
Contributor Author

Wauplin commented May 3, 2024

Thanks! Let me know if you have any question 🤗

@OlivierKessler01
Copy link

Hi @Wauplin I don't know how you set-up your notifications, if mentionning the issue in a PR suffices or not, but check this out :) #2280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants