github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/cmd/mkdir/mkdir.go (about)

     1  package mkdir
     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:   "mkdir remote:path",
    17  	Short: `Make the path if it doesn't already exist.`,
    18  	Run: func(command *cobra.Command, args []string) {
    19  		cmd.CheckArgs(1, 1, command, args)
    20  		fdst := cmd.NewFsDir(args)
    21  		cmd.Run(true, false, command, func() error {
    22  			return operations.Mkdir(context.Background(), fdst, "")
    23  		})
    24  	},
    25  }