"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
S3: Fix mkdir not to error if bucket exists and implement SetModTime
Nick Craig-Wood38ce4c362903
diff --git a/fs_s3.go b/fs_s3.goindex f4d9ae3ca..5cb6f2648 100644--- a/fs_s3.go+++ b/fs_s3.go@@ -248,7 +248,13 @@ func (f *FsS3) Put(src FsObject) {// Mkdir creates the bucket if it doesn't existfunc (f *FsS3) Mkdir() error {- return f.b.PutBucket(f.perm)+ err := f.b.PutBucket(f.perm)+ if err, ok := err.(*s3.Error); ok {+ if err.Code == "BucketAlreadyOwnedByYou" {+ return nil+ }+ }+ return err}// Rmdir deletes the bucket@@ -329,20 +335,18 @@ func (fs *FsObjectS3) ModTime() time.Time {// Sets the modification time of the local fs objectfunc (fs *FsObjectS3) SetModTime(modTime time.Time) {- // FIXME goamz can't set metadata, though it is possible with a PUT and copy- FsLog(fs, "Can't set mod time yet: %s", modTime)- // err := fs.readMetaData()- // if err != nil {- // stats.Error()- // FsLog(fs, "Failed to read metadata: %s", err)- // return- // }- // fs.meta.SetModTime(modTime)- // err = fs.s3.c.ObjectUpdate(fs.s3.bucket, fs.remote, fs.meta.ObjectHeaders())- // if err != nil {- // stats.Error()- // FsLog(fs, "Failed to update remote mtime: %s", err)- // }+ err := fs.readMetaData()+ if err != nil {+ stats.Error()+ FsLog(fs, "Failed to read metadata: %s", err)+ return+ }+ fs.meta[metaMtime] = swift.TimeToFloatString(modTime)+ _, err = fs.s3.b.Update(fs.remote, fs.s3.perm, fs.meta)+ if err != nil {+ stats.Error()+ FsLog(fs, "Failed to update remote mtime: %s", err)+ }}// Is this object storablediff --git a/notes.txt b/notes.txtindex 53dc9320d..8c3d67522 100644--- a/notes.txt+++ b/notes.txt@@ -2,7 +2,7 @@ Todo* Factor fses into own packages* FIXME: ls without an argument for buckets/containers?* FIXME: More -dry-run checks for object transfer- * FIXME: EU Region not working+ * Might be quicker to check md5sums first? for swift <-> swift certainly, and maybe for small files* Ignoring the pseudo directories* if object.PseudoDirectory {* fmt.Printf("%9s %19s %s\n", "Directory", "-", fs.Remote())