forked from TrueCloudLab/rclone
drive: add --drive-size-as-quota to show storage quota usage for file size - fixes #3135
This commit is contained in:
parent
4b27c6719b
commit
e2fde62cd9
1 changed files with 17 additions and 1 deletions
|
@ -367,6 +367,14 @@ will download it anyway.`,
|
||||||
Default: false,
|
Default: false,
|
||||||
Help: "Keep new head revision of each file forever.",
|
Help: "Keep new head revision of each file forever.",
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
|
}, {
|
||||||
|
Name: "size_as_quota",
|
||||||
|
Default: false,
|
||||||
|
Help: `Show storage quota usage for file size.
|
||||||
|
|
||||||
|
The storage used by a file is the size of the current version plus any
|
||||||
|
older versions that have been set to keep forever.`,
|
||||||
|
Advanced: true,
|
||||||
}, {
|
}, {
|
||||||
Name: "v2_download_min_size",
|
Name: "v2_download_min_size",
|
||||||
Default: fs.SizeSuffix(-1),
|
Default: fs.SizeSuffix(-1),
|
||||||
|
@ -434,6 +442,7 @@ type Options struct {
|
||||||
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
||||||
AcknowledgeAbuse bool `config:"acknowledge_abuse"`
|
AcknowledgeAbuse bool `config:"acknowledge_abuse"`
|
||||||
KeepRevisionForever bool `config:"keep_revision_forever"`
|
KeepRevisionForever bool `config:"keep_revision_forever"`
|
||||||
|
SizeAsQuota bool `config:"size_as_quota"`
|
||||||
V2DownloadMinSize fs.SizeSuffix `config:"v2_download_min_size"`
|
V2DownloadMinSize fs.SizeSuffix `config:"v2_download_min_size"`
|
||||||
PacerMinSleep fs.Duration `config:"pacer_min_sleep"`
|
PacerMinSleep fs.Duration `config:"pacer_min_sleep"`
|
||||||
PacerBurst int `config:"pacer_burst"`
|
PacerBurst int `config:"pacer_burst"`
|
||||||
|
@ -643,6 +652,9 @@ func (f *Fs) list(dirIDs []string, title string, directoriesOnly, filesOnly, inc
|
||||||
if f.opt.SkipChecksumGphotos {
|
if f.opt.SkipChecksumGphotos {
|
||||||
fields += ",spaces"
|
fields += ",spaces"
|
||||||
}
|
}
|
||||||
|
if f.opt.SizeAsQuota {
|
||||||
|
fields += ",quotaBytesUsed"
|
||||||
|
}
|
||||||
|
|
||||||
fields = fmt.Sprintf("files(%s),nextPageToken", fields)
|
fields = fmt.Sprintf("files(%s),nextPageToken", fields)
|
||||||
|
|
||||||
|
@ -1018,13 +1030,17 @@ func (f *Fs) newBaseObject(remote string, info *drive.File) baseObject {
|
||||||
if f.opt.UseCreatedDate {
|
if f.opt.UseCreatedDate {
|
||||||
modifiedDate = info.CreatedTime
|
modifiedDate = info.CreatedTime
|
||||||
}
|
}
|
||||||
|
size := info.Size
|
||||||
|
if f.opt.SizeAsQuota {
|
||||||
|
size = info.QuotaBytesUsed
|
||||||
|
}
|
||||||
return baseObject{
|
return baseObject{
|
||||||
fs: f,
|
fs: f,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
id: info.Id,
|
id: info.Id,
|
||||||
modifiedDate: modifiedDate,
|
modifiedDate: modifiedDate,
|
||||||
mimeType: info.MimeType,
|
mimeType: info.MimeType,
|
||||||
bytes: info.Size,
|
bytes: size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue