GoogleCloudPlatform / GoogleCloudPlatform/gsutil
gsutil rm doesn't support -r flag in conjunction with -I flag
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
Based on the rm documentation, I expect to be able to run the following:
```
echo gs://bucket/dir | gsutil rm -r -I
```
However, this results in the following error:
```
CommandException: No URLs matched. Do the files you're operating on exist?
```
Using -I without -r works though:
```
echo gs://bucket/dir/file | gsutil rm -I
```
This makes it difficult to write a script that cleans up large numbers of directories in cases where glob isn't sufficient and programmatic filtering is necessary; e.g. gs://bucket/prefix_(\d+), where e.g. (\d+) <= 500000 or (\d+) % 100000 != 0. The -I parameter is necessary to work around command line length limits, using stdin instead.
Contributor guide
Research direction
Start by locating gsutil rm's handling of the -r and -I options, then reproduce the documented command with a directory URL supplied through stdin. Trace why recursive removal reports no matching URLs and add coverage for this combination; done means recursive stdin input removes the requested directory while the existing non-recursive -I behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100