github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/cmd/rmdir/rmdir.go (about) 1 package rmdir 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: "rmdir remote:path", 17 Short: `Remove the path if empty.`, 18 Long: ` 19 Remove the path. Note that you can't remove a path with 20 objects in it, use purge for that.`, 21 Run: func(command *cobra.Command, args []string) { 22 cmd.CheckArgs(1, 1, command, args) 23 fdst := cmd.NewFsDir(args) 24 cmd.Run(true, false, command, func() error { 25 return operations.Rmdir(context.Background(), fdst, "") 26 }) 27 }, 28 }