mirror of
https://github.com/rclone/rclone.git
synced 2025-01-25 15:49:33 +01:00
drive: add --drive-use-created-date to use created date as modified date
This commit is contained in:
parent
6fb868e00c
commit
9aa8815990
@ -61,6 +61,7 @@ var (
|
|||||||
driveSharedWithMe = flags.BoolP("drive-shared-with-me", "", false, "Only show files that are shared with me")
|
driveSharedWithMe = flags.BoolP("drive-shared-with-me", "", false, "Only show files that are shared with me")
|
||||||
driveTrashedOnly = flags.BoolP("drive-trashed-only", "", false, "Only show files that are in the trash")
|
driveTrashedOnly = flags.BoolP("drive-trashed-only", "", false, "Only show files that are in the trash")
|
||||||
driveExtensions = flags.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.")
|
driveExtensions = flags.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.")
|
||||||
|
driveUseCreatedDate = flags.BoolP("drive-use-created-date", "", false, "Use created date instead of modified date.")
|
||||||
driveListChunk = flags.Int64P("drive-list-chunk", "", 1000, "Size of listing chunk 100-1000. 0 to disable.")
|
driveListChunk = flags.Int64P("drive-list-chunk", "", 1000, "Size of listing chunk 100-1000. 0 to disable.")
|
||||||
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
|
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
|
||||||
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
|
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
|
||||||
@ -97,7 +98,7 @@ var (
|
|||||||
"text/tab-separated-values": "tsv",
|
"text/tab-separated-values": "tsv",
|
||||||
}
|
}
|
||||||
extensionToMimeType map[string]string
|
extensionToMimeType map[string]string
|
||||||
partialFields = "id,name,size,md5Checksum,trashed,modifiedTime,mimeType"
|
partialFields = "id,name,size,md5Checksum,trashed,modifiedTime,createdTime,mimeType"
|
||||||
exportFormatsOnce sync.Once // make sure we fetch the export formats only once
|
exportFormatsOnce sync.Once // make sure we fetch the export formats only once
|
||||||
_exportFormats map[string][]string // allowed export mime-type conversions
|
_exportFormats map[string][]string // allowed export mime-type conversions
|
||||||
)
|
)
|
||||||
@ -1320,7 +1321,11 @@ func (o *Object) setMetaData(info *drive.File) {
|
|||||||
o.url = fmt.Sprintf("%sfiles/%s?alt=media", o.fs.svc.BasePath, info.Id)
|
o.url = fmt.Sprintf("%sfiles/%s?alt=media", o.fs.svc.BasePath, info.Id)
|
||||||
o.md5sum = strings.ToLower(info.Md5Checksum)
|
o.md5sum = strings.ToLower(info.Md5Checksum)
|
||||||
o.bytes = info.Size
|
o.bytes = info.Size
|
||||||
|
if *driveUseCreatedDate {
|
||||||
|
o.modifiedDate = info.CreatedTime
|
||||||
|
} else {
|
||||||
o.modifiedDate = info.ModifiedTime
|
o.modifiedDate = info.ModifiedTime
|
||||||
|
}
|
||||||
o.mimeType = info.MimeType
|
o.mimeType = info.MimeType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,6 +370,27 @@ Controls whether files are sent to the trash or deleted
|
|||||||
permanently. Defaults to true, namely sending files to the trash. Use
|
permanently. Defaults to true, namely sending files to the trash. Use
|
||||||
`--drive-use-trash=false` to delete files permanently instead.
|
`--drive-use-trash=false` to delete files permanently instead.
|
||||||
|
|
||||||
|
#### --drive-use-created-date ####
|
||||||
|
|
||||||
|
Use the file creation date in place of the modification date. Defaults
|
||||||
|
to false.
|
||||||
|
|
||||||
|
Useful when downloading data and you want the creation date used in
|
||||||
|
place of the last modified date.
|
||||||
|
|
||||||
|
**WARNING**: This flag may have some unexpected consequences.
|
||||||
|
|
||||||
|
When uploading to your drive all files will be overwritten unless they
|
||||||
|
haven't been modified since their creation. And the inverse will occur
|
||||||
|
while downloading. This side effect can be avoided by using the
|
||||||
|
`--checksum` flag.
|
||||||
|
|
||||||
|
This feature was implemented to retain photos capture date as recorded
|
||||||
|
by google photos. You will first need to check the "Create a Google
|
||||||
|
Photos folder" option in your google drive settings. You can then copy
|
||||||
|
or move the photos locally and use the date the image was taken
|
||||||
|
(created) set as the modification date.
|
||||||
|
|
||||||
### Limitations ###
|
### Limitations ###
|
||||||
|
|
||||||
Drive has quite a lot of rate limiting. This causes rclone to be
|
Drive has quite a lot of rate limiting. This causes rclone to be
|
||||||
|
Loading…
Reference in New Issue
Block a user