"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
FileExists check if a file exists
Iakov Davydov7ae708082450
diff --git a/fs/fs.go b/fs/fs.goindex e339ed222..a96bff041 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -733,3 +733,16 @@ func CheckClose(c io.Closer, err *error) {*err = cerr}}++// FileExists returns true if a file remote exists.+// If remote is a directory, FileExists returns false.+func FileExists(fs Fs, remote string) (bool, error) {+ _, err := fs.NewObject(remote)+ if err != nil {+ if err == ErrorObjectNotFound || err == ErrorNotAFile {+ return false, nil+ }+ return false, err+ }+ return true, nil+}