當前位置: 首頁>>代碼示例>>Golang>>正文


Golang fs.Rmdir函數代碼示例

本文整理匯總了Golang中github.com/ncw/rclone/fs.Rmdir函數的典型用法代碼示例。如果您正苦於以下問題:Golang Rmdir函數的具體用法?Golang Rmdir怎麽用?Golang Rmdir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Rmdir函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestFsMkdirRmdirSubdir

// TestFsMkdirRmdirSubdir tests making and removing a sub directory
func TestFsMkdirRmdirSubdir(t *testing.T) {
	skipIfNotOk(t)
	dir := "dir/subdir"
	err := fs.Mkdir(remote, dir)
	require.NoError(t, err)
	fstest.CheckListingWithPrecision(t, remote, []fstest.Item{}, []string{"dir", "dir/subdir"}, fs.Config.ModifyWindow)

	err = fs.Rmdir(remote, dir)
	require.NoError(t, err)
	fstest.CheckListingWithPrecision(t, remote, []fstest.Item{}, []string{"dir"}, fs.Config.ModifyWindow)

	err = fs.Rmdir(remote, "dir")
	require.NoError(t, err)
	fstest.CheckListingWithPrecision(t, remote, []fstest.Item{}, []string{}, fs.Config.ModifyWindow)
}
開發者ID:ncw,項目名稱:rclone,代碼行數:16,代碼來源:fstests.go

示例2:

        Make the path if it doesn't already exist`,
		Run: func(fdst, fsrc fs.Fs) error {
			return fs.Mkdir(fdst)
		},
		MinArgs: 1,
		MaxArgs: 1,
		Retry:   true,
	},
	{
		Name:     "rmdir",
		ArgsHelp: "remote:path",
		Help: `
        Remove the path.  Note that you can't remove a path with
        objects in it, use purge for that.`,
		Run: func(fdst, fsrc fs.Fs) error {
			return fs.Rmdir(fdst)
		},
		MinArgs: 1,
		MaxArgs: 1,
		Retry:   true,
	},
	{
		Name:     "purge",
		ArgsHelp: "remote:path",
		Help: `
        Remove the path and all of its contents.`,
		Run: func(fdst, fsrc fs.Fs) error {
			return fs.Purge(fdst)
		},
		MinArgs: 1,
		MaxArgs: 1,
開發者ID:JoeyGo23,項目名稱:rclone,代碼行數:31,代碼來源:rclone.go

示例3: TestRmdir

// TestRmdir tests Rmdir works
func TestRmdir(t *testing.T, remote fs.Fs) {
	err := fs.Rmdir(remote)
	require.NoError(t, err)
}
開發者ID:yut148,項目名稱:rclone,代碼行數:5,代碼來源:fstest.go

示例4: TestRmdir

// TestRmdir tests Rmdir works
func TestRmdir(t *testing.T, remote fs.Fs) {
	err := fs.Rmdir(remote)
	if err != nil {
		t.Fatalf("Rmdir failed: %v", err)
	}
}
開發者ID:nicot,項目名稱:rclone,代碼行數:7,代碼來源:fstest.go

示例5:

			err := fs.Mkdir(fdst)
			if err != nil {
				log.Fatalf("Failed to mkdir: %v", err)
			}
		},
		MinArgs: 1,
		MaxArgs: 1,
	},
	{
		Name:     "rmdir",
		ArgsHelp: "remote:path",
		Help: `
        Remove the path.  Note that you can't remove a path with
        objects in it, use purge for that.`,
		Run: func(fdst, fsrc fs.Fs) {
			err := fs.Rmdir(fdst)
			if err != nil {
				log.Fatalf("Failed to rmdir: %v", err)
			}
		},
		MinArgs: 1,
		MaxArgs: 1,
	},
	{
		Name:     "purge",
		ArgsHelp: "remote:path",
		Help: `
        Remove the path and all of its contents.`,
		Run: func(fdst, fsrc fs.Fs) {
			err := fs.Purge(fdst)
			if err != nil {
開發者ID:shimondoodkin,項目名稱:rclone,代碼行數:31,代碼來源:rclone.go

示例6: init

package rmdir

import (
	"github.com/ncw/rclone/cmd"
	"github.com/ncw/rclone/fs"
	"github.com/spf13/cobra"
)

func init() {
	cmd.Root.AddCommand(commandDefintion)
}

var commandDefintion = &cobra.Command{
	Use:   "rmdir remote:path",
	Short: `Remove the path if empty.`,
	Long: `
Remove the path.  Note that you can't remove a path with
objects in it, use purge for that.`,
	Run: func(command *cobra.Command, args []string) {
		cmd.CheckArgs(1, 1, command, args)
		fdst := cmd.NewFsDst(args)
		cmd.Run(true, false, command, func() error {
			return fs.Rmdir(fdst, "")
		})
	},
}
開發者ID:ncw,項目名稱:rclone,代碼行數:26,代碼來源:rmdir.go


注:本文中的github.com/ncw/rclone/fs.Rmdir函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。