"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Add Root() to Fs interface
Nick Craig-Wood92745aa950aa
diff --git a/drive/drive.go b/drive/drive.goindex 30430c474..37c099adc 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -160,6 +160,11 @@ func (f *FsDrive) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsDrive) Root() string {+ return f.root+}+// String converts this FsDrive to a stringfunc (f *FsDrive) String() string {return fmt.Sprintf("Google drive root '%s'", f.root)diff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex 391a4aa8e..083fc9df2 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -114,6 +114,11 @@ func (f *FsDropbox) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsDropbox) Root() string {+ return f.root+}+// String converts this FsDropbox to a stringfunc (f *FsDropbox) String() string {return fmt.Sprintf("Dropbox root '%s'", f.root)diff --git a/fs/fs.go b/fs/fs.goindex 8350bd01b..8e8cbe065 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -70,6 +70,9 @@ type Fs interface {// The name of the remote (as passed into NewFs)Name() string+ // The root of the remote (as passed into NewFs)+ Root() string+// String returns a description of the FSString() stringdiff --git a/fs/limited.go b/fs/limited.goindex 8f80396c3..06042f7a3 100644--- a/fs/limited.go+++ b/fs/limited.go@@ -26,6 +26,11 @@ func (f *Limited) Name() string {return f.fs.Name() // return name of underlying remote}+// The root of the remote (as passed into NewFs)+func (f *Limited) Root() string {+ return f.fs.Root() // return root of underlying remote+}+// String returns a description of the FSfunc (f *Limited) String() string {return fmt.Sprintf("%s limited to %d objects", f.fs.String(), len(f.objects))diff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.goindex 8ced5a430..f467df81d 100644--- a/googlecloudstorage/googlecloudstorage.go+++ b/googlecloudstorage/googlecloudstorage.go@@ -149,6 +149,14 @@ func (f *FsStorage) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsStorage) Root() string {+ if f.root == "" {+ return f.bucket+ }+ return f.bucket + "/" + f.root+}+// String converts this FsStorage to a stringfunc (f *FsStorage) String() string {if f.root == "" {diff --git a/local/local.go b/local/local.goindex 40992382d..f6dae8b99 100644--- a/local/local.go+++ b/local/local.go@@ -77,6 +77,11 @@ func (f *FsLocal) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsLocal) Root() string {+ return f.root+}+// String converts this FsLocal to a stringfunc (f *FsLocal) String() string {return fmt.Sprintf("Local file system at %s", f.root)diff --git a/s3/s3.go b/s3/s3.goindex 98c209fee..73c078753 100644--- a/s3/s3.go+++ b/s3/s3.go@@ -158,6 +158,14 @@ func (f *FsS3) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsS3) Root() string {+ if f.root == "" {+ return f.bucket+ }+ return f.bucket + "/" + f.root+}+// String converts this FsS3 to a stringfunc (f *FsS3) String() string {if f.root == "" {diff --git a/swift/swift.go b/swift/swift.goindex 0e7a368be..5b41fca35 100644--- a/swift/swift.go+++ b/swift/swift.go@@ -81,6 +81,14 @@ func (f *FsSwift) Name() string {return f.name}+// The root of the remote (as passed into NewFs)+func (f *FsSwift) Root() string {+ if f.root == "" {+ return f.container+ }+ return f.container + "/" + f.root+}+// String converts this FsSwift to a stringfunc (f *FsSwift) String() string {if f.root == "" {