mirror of
https://github.com/rclone/rclone.git
synced 2024-12-25 16:38:59 +01:00
11da2a6c9b
The purpose of this is to make it easier to maintain and eventually to allow the rclone backends to be re-used in other projects without having to use the rclone configuration system. The new code layout is documented in CONTRIBUTING.
42 lines
1011 B
Go
42 lines
1011 B
Go
package delete
|
|
|
|
import (
|
|
"github.com/ncw/rclone/cmd"
|
|
"github.com/ncw/rclone/fs/operations"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cmd.Root.AddCommand(commandDefintion)
|
|
}
|
|
|
|
var commandDefintion = &cobra.Command{
|
|
Use: "delete remote:path",
|
|
Short: `Remove the contents of path.`,
|
|
Long: `
|
|
Remove the contents of path. Unlike ` + "`" + `purge` + "`" + ` it obeys include/exclude
|
|
filters so can be used to selectively delete files.
|
|
|
|
Eg delete all files bigger than 100MBytes
|
|
|
|
Check what would be deleted first (use either)
|
|
|
|
rclone --min-size 100M lsl remote:path
|
|
rclone --dry-run --min-size 100M delete remote:path
|
|
|
|
Then delete
|
|
|
|
rclone --min-size 100M delete remote:path
|
|
|
|
That reads "delete everything with a minimum size of 100 MB", hence
|
|
delete all files bigger than 100MBytes.
|
|
`,
|
|
Run: func(command *cobra.Command, args []string) {
|
|
cmd.CheckArgs(1, 1, command, args)
|
|
fsrc := cmd.NewFsSrc(args)
|
|
cmd.Run(true, false, command, func() error {
|
|
return operations.Delete(fsrc)
|
|
})
|
|
},
|
|
}
|