github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/cmd/purge/purge.go (about) 1 package purge 2 3 import ( 4 "context" 5 6 "github.com/rclone/rclone/cmd" 7 "github.com/rclone/rclone/fs/operations" 8 "github.com/spf13/cobra" 9 ) 10 11 func init() { 12 cmd.Root.AddCommand(commandDefinition) 13 } 14 15 var commandDefinition = &cobra.Command{ 16 Use: "purge remote:path", 17 Short: `Remove the path and all of its contents.`, 18 Long: ` 19 Remove the path and all of its contents. Note that this does not obey 20 include/exclude filters - everything will be removed. Use ` + "`" + `delete` + "`" + ` if 21 you want to selectively delete files. 22 `, 23 Run: func(command *cobra.Command, args []string) { 24 cmd.CheckArgs(1, 1, command, args) 25 fdst := cmd.NewFsDir(args) 26 cmd.Run(true, false, command, func() error { 27 return operations.Purge(context.Background(), fdst, "") 28 }) 29 }, 30 }