B2_Command_Line_Tool icon indicating copy to clipboard operation
B2_Command_Line_Tool copied to clipboard

Add rm cmd

Open krzysztofgromadzki opened this issue 6 years ago • 11 comments

Resolving improvement suggestion: Backblaze/B2_Command_Line_Tool#165

Added 'rm' cmdline command to easily remove files on the remote side - in the bucket. Globs are used to define patterns of the files to remove.

krzysztofgromadzki avatar Feb 12 '18 17:02 krzysztofgromadzki

People are going to love this feature!

I think the names rm and erm are a little subtle. We don't want to make it too easy for people to accidentally delete all their files. I'd like to suggest an alternative command-line syntax:

b2 rm [--report] [--versions] [--glob] [--regex] <bucketName> <thing_to_delete> ...

Without either option, it would delete only exact matches, and won't delete all files. With either --glob or --regex, it would do the kind of matching specified. You would have to go to a little effort to delete all files.

bwbeach avatar Feb 14 '18 23:02 bwbeach

Nice seeing this finally implemented! I think a --dryRun option, just like for sync, makes sense here. Otherwise there is no real way to test your glob/regex. Or alternatively have the ls support the same kind of filtering.

svonohr avatar Feb 15 '18 07:02 svonohr

@krzysztofgromadzki - Are you interested in making the changes to the command-line syntax?

I like the suggestion of a --dryRun option.

The other thing that would be good, but is less urgent, is a --threads option to specify the number of threads do to the deletion work.

bwbeach avatar Feb 16 '18 01:02 bwbeach

@bwbeach I've already started it. I'll change command-line syntax and add --dry and --threads flags.

krzysztofgromadzki avatar Feb 16 '18 10:02 krzysztofgromadzki

Any updates on this? As a potential customer and speaking on behalf of my employer, I'd love to see it.

skorasaurus avatar Sep 12 '18 13:09 skorasaurus

This has been abandoned months ago, nobody is working on it

ppolewicz avatar Sep 12 '18 22:09 ppolewicz

@ppolewicz This is still very much needed, very unfortunate, that it wasn't merged. Even something simple to just delete one file would be great!

dreamflasher avatar Apr 06 '21 10:04 dreamflasher

@ppolewicz Who owns the abandoned code here? I'm wondering about pushing it to the finish line sometime.

metadaddy avatar Aug 25 '22 20:08 metadaddy

I reviewed it and a surprisingly good chunk of it can be salvaged, though some of it needs to land in b2-sdk-python. @metadaddy where you thinking about finishing it yourself or should I assign someone to do it?

ppolewicz avatar Aug 26 '22 15:08 ppolewicz

I was thinking of adopting it myself, but if you have someone that can work on it, @ppolewicz, it would happen faster!

metadaddy avatar Aug 26 '22 16:08 metadaddy

all right, I found someone to do it

ppolewicz avatar Sep 15 '22 17:09 ppolewicz

Superseded by #849

ppolewicz avatar Feb 01 '23 18:02 ppolewicz