github.com/ncw/rclone@v1.48.1-0.20190724201158-a35aa1360e3e/cmd/cleanup/cleanup.go (about)

     1  package cleanup
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/ncw/rclone/cmd"
     7  	"github.com/ncw/rclone/fs/operations"
     8  	"github.com/spf13/cobra"
     9  )
    10  
    11  func init() {
    12  	cmd.Root.AddCommand(commandDefintion)
    13  }
    14  
    15  var commandDefintion = &cobra.Command{
    16  	Use:   "cleanup remote:path",
    17  	Short: `Clean up the remote if possible`,
    18  	Long: `
    19  Clean up the remote if possible.  Empty the trash or delete old file
    20  versions. Not supported by all remotes.
    21  `,
    22  	Run: func(command *cobra.Command, args []string) {
    23  		cmd.CheckArgs(1, 1, command, args)
    24  		fsrc := cmd.NewFsSrc(args)
    25  		cmd.Run(true, false, command, func() error {
    26  			return operations.CleanUp(context.Background(), fsrc)
    27  		})
    28  	},
    29  }