mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +00:00
Updated print filecounts and update filerevisions
This commit is contained in:
@@ -10,6 +10,17 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
|||||||
|
|
||||||
See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation
|
See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation
|
||||||
|
|
||||||
|
### 7.00.02
|
||||||
|
|
||||||
|
Added option `showlastmodification` to `gam <UserTypeEntity> print|show filecounts` that adds
|
||||||
|
the following fields to the output: `lastModifiedFileId,lastModifiedFileName,lastModifyingUser,lastModifiedTime`;
|
||||||
|
these are for the most recently modified file.
|
||||||
|
|
||||||
|
Added option `keepforever [<Boolean>]` to `gam <UserTypeEntity> update filerevisions` that allows setting
|
||||||
|
`Keep forever` in revisions.
|
||||||
|
|
||||||
|
Upgraded to Python 3.12.6 where possible.
|
||||||
|
|
||||||
### 7.00.01
|
### 7.00.01
|
||||||
|
|
||||||
Added option `shownames` to `gam <UserTypeEntity> print|show sheet` that causes GAM
|
Added option `shownames` to `gam <UserTypeEntity> print|show sheet` that causes GAM
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||||
admin@server:/Users/admin$ gam version
|
admin@server:/Users/admin$ gam version
|
||||||
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 7.00.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 7.00.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
MacOS Sonoma 14.5 x86_64
|
MacOS Sonoma 14.5 x86_64
|
||||||
@@ -923,7 +923,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
C:\>del C:\GAMConfig\oauth2.txt
|
C:\>del C:\GAMConfig\oauth2.txt
|
||||||
C:\>gam version
|
C:\>gam version
|
||||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 7.00.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 7.00.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
Windows-10-10.0.17134 AMD64
|
Windows-10-10.0.17134 AMD64
|
||||||
|
|||||||
@@ -693,7 +693,8 @@ gam <UserTypeEntity> print filecounts [todrive <ToDriveAttribute>*]
|
|||||||
[filenamematchpattern <RegularExpression>]
|
[filenamematchpattern <RegularExpression>]
|
||||||
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
[excludetrashed]
|
[excludetrashed]
|
||||||
[showsize] [showmimetypesize] (addcsvdata <FieldName> <String>)*
|
[showsize] [showmimetypesize] [showlastmodification]
|
||||||
|
(addcsvdata <FieldName> <String>)*
|
||||||
[summary none|only|plus] [summaryuser <String>]
|
[summary none|only|plus] [summaryuser <String>]
|
||||||
gam <UserTypeEntity> show filecounts
|
gam <UserTypeEntity> show filecounts
|
||||||
[((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>)
|
[((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>)
|
||||||
@@ -707,13 +708,13 @@ gam <UserTypeEntity> show filecounts
|
|||||||
[filenamematchpattern <RegularExpression>]
|
[filenamematchpattern <RegularExpression>]
|
||||||
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
[excludetrashed]
|
[excludetrashed]
|
||||||
[showsize] [showmimetypesize]
|
[showsize] [showmimetypesize] [showlastmodification]
|
||||||
[summary none|only|plus] [summaryuser <String>]
|
[summary none|only|plus] [summaryuser <String>]
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, print filecounts displays counts of all files owned by the specified [`<UserTypeEntity>`](Collections-of-Users).
|
By default, print filecounts displays counts of all files owned by the specified [`<UserTypeEntity>`](Collections-of-Users).
|
||||||
|
|
||||||
The option `continueoninvalidquery [<Boolean>] can be used in special cases where a query of the form
|
The option `continueoninvalidquery [<Boolean>] can be used in special cases where a query of the form
|
||||||
`query "'labels/mRoha85IbwCRl490E00xGLvBsSbkwIiuZ6PRNNEbwxyz' in labels" causes Google to issue an error
|
`query "'labels/mRoha85IbwCRl490E00xGLvBsSbkwIiuZ6PRNNEbwxyz' in labels" causes Google to issue an error
|
||||||
saying that the query is invalid when, in fact, it is but the user does not have a license that suppprts drive file labels.
|
saying that the query is invalid when, in fact, it is but the user does not have a license that suppprts drive file labels.
|
||||||
When `continueoninvalidquery` is true, GAM prints an error message and proceeds to the next user rather that terminating
|
When `continueoninvalidquery` is true, GAM prints an error message and proceeds to the next user rather that terminating
|
||||||
@@ -723,6 +724,10 @@ The `showsize` option displays the total size (in bytes) of the files counted.
|
|||||||
|
|
||||||
The showmimetypesize' displays the total size (in bytes) of each MIME type counted.
|
The showmimetypesize' displays the total size (in bytes) of each MIME type counted.
|
||||||
|
|
||||||
|
The option `showlastmodification` displays the following fields:
|
||||||
|
`lastModifiedFileId,lastModifiedFileName,lastModifyingUser,lastModifiedTime`;
|
||||||
|
these are for the most recently modified file.
|
||||||
|
|
||||||
For print filecouts, add additional columns of data from the command line to the output:
|
For print filecouts, add additional columns of data from the command line to the output:
|
||||||
* `addcsvdata <FieldName> <String>` - Add additional columns of data from the command line to the output
|
* `addcsvdata <FieldName> <String>` - Add additional columns of data from the command line to the output
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ gam <UserTypeEntity> update filerevisions <DriveFileEntity> select <DriveFileRev
|
|||||||
```
|
```
|
||||||
When `select <DriveFileRevisionIDEntity>` is omitted, all revisions are updated.
|
When `select <DriveFileRevisionIDEntity>` is omitted, all revisions are updated.
|
||||||
|
|
||||||
|
* `keepforever true` - Keep revision forever, even if it is no longer the head revision
|
||||||
|
* `keepforever false` - Do not keep revision forever
|
||||||
* `published true` - Publish these revision to the web
|
* `published true` - Publish these revision to the web
|
||||||
* `published false` - Do not publish these revision to the web
|
* `published false` - Do not publish these revision to the web
|
||||||
* `publishauto true` - Automaticaly publish subsequent revisions to the web
|
* `publishauto true` - Automaticaly publish subsequent revisions to the web
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Print the current version of Gam with details
|
Print the current version of Gam with details
|
||||||
```
|
```
|
||||||
gam version
|
gam version
|
||||||
GAMADV-XTD3 7.00.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 7.00.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
MacOS Sonoma 14.5 x86_64
|
MacOS Sonoma 14.5 x86_64
|
||||||
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
|
|||||||
Print the current version of Gam with details and time offset information
|
Print the current version of Gam with details and time offset information
|
||||||
```
|
```
|
||||||
gam version timeoffset
|
gam version timeoffset
|
||||||
GAMADV-XTD3 7.00.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 7.00.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
MacOS Sonoma 14.5 x86_64
|
MacOS Sonoma 14.5 x86_64
|
||||||
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
|
|||||||
Print the current version of Gam with extended details and SSL information
|
Print the current version of Gam with extended details and SSL information
|
||||||
```
|
```
|
||||||
gam version extended
|
gam version extended
|
||||||
GAMADV-XTD3 7.00.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 7.00.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
MacOS Sonoma 14.5 x86_64
|
MacOS Sonoma 14.5 x86_64
|
||||||
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
|
|||||||
Path: /Users/Admin/bin/gamadv-xtd3
|
Path: /Users/Admin/bin/gamadv-xtd3
|
||||||
Version Check:
|
Version Check:
|
||||||
Current: 5.35.08
|
Current: 5.35.08
|
||||||
Latest: 7.00.01
|
Latest: 7.00.02
|
||||||
echo $?
|
echo $?
|
||||||
1
|
1
|
||||||
```
|
```
|
||||||
@@ -72,7 +72,7 @@ echo $?
|
|||||||
Print the current version number without details
|
Print the current version number without details
|
||||||
```
|
```
|
||||||
gam version simple
|
gam version simple
|
||||||
7.00.01
|
7.00.02
|
||||||
```
|
```
|
||||||
In Linux/MacOS you can do:
|
In Linux/MacOS you can do:
|
||||||
```
|
```
|
||||||
@@ -82,7 +82,7 @@ echo $VER
|
|||||||
Print the current version of Gam and address of this Wiki
|
Print the current version of Gam and address of this Wiki
|
||||||
```
|
```
|
||||||
gam help
|
gam help
|
||||||
GAM 7.00.01 - https://github.com/taers232c/GAMADV-XTD3
|
GAM 7.00.02 - https://github.com/taers232c/GAMADV-XTD3
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.5 64-bit final
|
Python 3.12.5 64-bit final
|
||||||
MacOS Sonoma 14.5 x86_64
|
MacOS Sonoma 14.5 x86_64
|
||||||
|
|||||||
@@ -7043,7 +7043,8 @@ gam <UserTypeEntity> print filecounts [todrive <ToDriveAttribute>*]
|
|||||||
[filenamematchpattern <RegularExpression>]
|
[filenamematchpattern <RegularExpression>]
|
||||||
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
[excludetrashed]
|
[excludetrashed]
|
||||||
[showsize] [showmimetypesize] (addcsvdata <FieldName> <String>)*
|
[showsize] [showmimetypesize] [showlastmodification]
|
||||||
|
(addcsvdata <FieldName> <String>)*
|
||||||
[summary none|only|plus] [summaryuser <String>]
|
[summary none|only|plus] [summaryuser <String>]
|
||||||
gam <UserTypeEntity> show filecounts
|
gam <UserTypeEntity> show filecounts
|
||||||
[((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>)
|
[((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>)
|
||||||
@@ -7057,7 +7058,7 @@ gam <UserTypeEntity> show filecounts
|
|||||||
[filenamematchpattern <RegularExpression>]
|
[filenamematchpattern <RegularExpression>]
|
||||||
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
<PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
[excludetrashed]
|
[excludetrashed]
|
||||||
[showsize] [showmimetypesize]
|
[showsize] [showmimetypesize] [showlastmodification]
|
||||||
[summary none|only|plus] [summaryuser <String>]
|
[summary none|only|plus] [summaryuser <String>]
|
||||||
|
|
||||||
gam <UserTypeEntity> print filesharecounts [todrive <ToDriveAttribute>*]
|
gam <UserTypeEntity> print filesharecounts [todrive <ToDriveAttribute>*]
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
|
7.00.02
|
||||||
|
|
||||||
|
Added option `showlastmodification` to `gam <UserTypeEntity> print|show filecounts` that adds
|
||||||
|
the following fields to the output: `lastModifiedFileId,lastModifiedFileName,lastModifyingUser,lastModifiedTime`;
|
||||||
|
these are for the most recently modified file.
|
||||||
|
|
||||||
|
Added option `keepforever [<Boolean>]` to `gam <UserTypeEntity> update filerevisions` that allows setting
|
||||||
|
`Keep forever` in revisions.
|
||||||
|
|
||||||
|
Upgraded to Python 3.12.6 where possible.
|
||||||
|
|
||||||
7.00.01
|
7.00.01
|
||||||
|
|
||||||
Added option `shownames` to `gam <UserTypeEntity> print|show sheet` that causes GAM
|
Added option `shownames` to `gam <UserTypeEntity> print|show sheet` that causes GAM
|
||||||
to make an additional API call to get and display the sheet file name that is not supplied by the Sheets API.
|
to make an additional API call to get and display the sheet file name that is not supplied by the Sheets API.
|
||||||
|
|
||||||
|
|
||||||
7.00.00
|
7.00.00
|
||||||
|
|
||||||
Merged GAM-Team version
|
Merged GAM-Team version
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.00.01'
|
__version__ = '7.00.02'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
#pylint: disable=wrong-import-position
|
#pylint: disable=wrong-import-position
|
||||||
@@ -53967,12 +53967,14 @@ def deleteFileRevisions(users):
|
|||||||
Ind.Decrement()
|
Ind.Decrement()
|
||||||
|
|
||||||
REVISIONS_FIELDS_CHOICE_MAP = {
|
REVISIONS_FIELDS_CHOICE_MAP = {
|
||||||
|
'keepforever': 'keepForever',
|
||||||
'published': 'published',
|
'published': 'published',
|
||||||
'publishauto': 'publishAuto',
|
'publishauto': 'publishAuto',
|
||||||
'publishedoutsidedomain': 'publishedOutsideDomain'
|
'publishedoutsidedomain': 'publishedOutsideDomain'
|
||||||
}
|
}
|
||||||
# gam <UserTypeEntity> update filerevisions <DriveFileEntity> select <DriveFileRevisionIdEntity> [previewupdate]
|
# gam <UserTypeEntity> update filerevisions <DriveFileEntity> select <DriveFileRevisionIdEntity> [previewupdate]
|
||||||
# [published [<Boolean>]] [publishauto [<Boolean>]] [publishedoutsidedomain [<Boolean>]]
|
# [published [<Boolean>]] [publishauto [<Boolean>]] [publishedoutsidedomain [<Boolean>]]
|
||||||
|
# [keepforever [<Boolean>]}
|
||||||
# [showtitles] [doit] [max_to_update <Number>]
|
# [showtitles] [doit] [max_to_update <Number>]
|
||||||
def updateFileRevisions(users):
|
def updateFileRevisions(users):
|
||||||
fileIdEntity = getDriveFileEntity()
|
fileIdEntity = getDriveFileEntity()
|
||||||
@@ -56118,7 +56120,8 @@ def printFileParentTree(users):
|
|||||||
# [filenamematchpattern <RegularExpression>]
|
# [filenamematchpattern <RegularExpression>]
|
||||||
# <PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
# <PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
# [excludetrashed] (addcsvdata <FieldName> <String>)*
|
# [excludetrashed] (addcsvdata <FieldName> <String>)*
|
||||||
# [showsize] [showmimetypesize]
|
# [showsize] [showmimetypesize] [showlastmodification]
|
||||||
|
# (addcsvdata <FieldName> <String>)*
|
||||||
# [summary none|only|plus] [summaryuser <String>]
|
# [summary none|only|plus] [summaryuser <String>]
|
||||||
# gam <UserTypeEntity> show filecounts
|
# gam <UserTypeEntity> show filecounts
|
||||||
# [((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>) (querytime<String> <Time>)*]
|
# [((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>) (querytime<String> <Time>)*]
|
||||||
@@ -56131,7 +56134,7 @@ def printFileParentTree(users):
|
|||||||
# [filenamematchpattern <RegularExpression>]
|
# [filenamematchpattern <RegularExpression>]
|
||||||
# <PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
# <PermissionMatch>* [<PermissionMatchMode>] [<PermissionMatchAction>]
|
||||||
# [excludetrashed]
|
# [excludetrashed]
|
||||||
# [showsize] [showmimetypesize]
|
# [showsize] [showmimetypesize] [showlastmodification]
|
||||||
# [summary none|only|plus] [summaryuser <String>]
|
# [summary none|only|plus] [summaryuser <String>]
|
||||||
def printShowFileCounts(users):
|
def printShowFileCounts(users):
|
||||||
def _setSelectionFields():
|
def _setSelectionFields():
|
||||||
@@ -56139,6 +56142,8 @@ def printShowFileCounts(users):
|
|||||||
fieldsList.extend(OWNED_BY_ME_FIELDS_TITLES)
|
fieldsList.extend(OWNED_BY_ME_FIELDS_TITLES)
|
||||||
if showSize or (DLP.minimumFileSize is not None) or (DLP.maximumFileSize is not None):
|
if showSize or (DLP.minimumFileSize is not None) or (DLP.maximumFileSize is not None):
|
||||||
fieldsList.append(sizeField)
|
fieldsList.append(sizeField)
|
||||||
|
if showLastModification:
|
||||||
|
fieldsList.extend(['id,name,modifiedTime,lastModifyingUser(emailAddress)'])
|
||||||
if DLP.filenameMatchPattern:
|
if DLP.filenameMatchPattern:
|
||||||
fieldsList.append('name')
|
fieldsList.append('name')
|
||||||
if DLP.excludeTrashed:
|
if DLP.excludeTrashed:
|
||||||
@@ -56148,7 +56153,7 @@ def printShowFileCounts(users):
|
|||||||
if DLP.onlySharedDrives or getPermissionsForSharedDrives:
|
if DLP.onlySharedDrives or getPermissionsForSharedDrives:
|
||||||
fieldsList.append('driveId')
|
fieldsList.append('driveId')
|
||||||
|
|
||||||
def showMimeTypeInfo(user, mimeTypeInfo, sharedDriveId, sharedDriveName, i, count):
|
def showMimeTypeInfo(user, mimeTypeInfo, sharedDriveId, sharedDriveName, lastModification, i, count):
|
||||||
if summary != FILECOUNT_SUMMARY_NONE:
|
if summary != FILECOUNT_SUMMARY_NONE:
|
||||||
if count != 0:
|
if count != 0:
|
||||||
for mimeType, mtinfo in iter(mimeTypeInfo.items()):
|
for mimeType, mtinfo in iter(mimeTypeInfo.items()):
|
||||||
@@ -56173,6 +56178,10 @@ def printShowFileCounts(users):
|
|||||||
dataList.extend(['Item cap', f"{countTotal/SHARED_DRIVE_MAX_FILES_FOLDERS:.2%}"])
|
dataList.extend(['Item cap', f"{countTotal/SHARED_DRIVE_MAX_FILES_FOLDERS:.2%}"])
|
||||||
printEntityKVList(kvList, dataList, i, count)
|
printEntityKVList(kvList, dataList, i, count)
|
||||||
Ind.Increment()
|
Ind.Increment()
|
||||||
|
if showLastModification:
|
||||||
|
printKeyValueList(['lastModifiedFile', f'{lastModification['lastModifiedFileName']}({lastModification['lastModifiedFileId']})',
|
||||||
|
'lastModifyingUser', lastModification['lastModifyingUser'],
|
||||||
|
'lastModifiedTime', formatLocalTime(lastModification['lastModifiedTime'])])
|
||||||
for mimeType, mtinfo in sorted(iter(mimeTypeInfo.items())):
|
for mimeType, mtinfo in sorted(iter(mimeTypeInfo.items())):
|
||||||
if not showMimeTypeSize:
|
if not showMimeTypeSize:
|
||||||
printKeyValueList([mimeType, mtinfo['count']])
|
printKeyValueList([mimeType, mtinfo['count']])
|
||||||
@@ -56186,6 +56195,11 @@ def printShowFileCounts(users):
|
|||||||
row = {'User': user, 'Total': countTotal}
|
row = {'User': user, 'Total': countTotal}
|
||||||
if showSize:
|
if showSize:
|
||||||
row['Size'] = sizeTotal
|
row['Size'] = sizeTotal
|
||||||
|
if showLastModification:
|
||||||
|
row.update({'lastModifiedFileId': lastModification['lastModifiedFileId'],
|
||||||
|
'lastModifiedFileName': lastModification['lastModifiedFileName'],
|
||||||
|
'lastModifyingUser': lastModification['lastModifyingUser'],
|
||||||
|
'lastModifiedTime': formatLocalTime(lastModification['lastModifiedTime'])})
|
||||||
if addCSVData:
|
if addCSVData:
|
||||||
row.update(addCSVData)
|
row.update(addCSVData)
|
||||||
for mimeType, mtinfo in sorted(iter(mimeTypeInfo.items())):
|
for mimeType, mtinfo in sorted(iter(mimeTypeInfo.items())):
|
||||||
@@ -56200,13 +56214,16 @@ def printShowFileCounts(users):
|
|||||||
fieldsList = ['mimeType']
|
fieldsList = ['mimeType']
|
||||||
DLP = DriveListParameters({'allowChoose': False, 'allowCorpora': True, 'allowQuery': True, 'mimeTypeInQuery': True})
|
DLP = DriveListParameters({'allowChoose': False, 'allowCorpora': True, 'allowQuery': True, 'mimeTypeInQuery': True})
|
||||||
sharedDriveId = sharedDriveName = ''
|
sharedDriveId = sharedDriveName = ''
|
||||||
continueOnInvalidQuery = showSize = showMimeTypeSize = False
|
continueOnInvalidQuery = showSize = showLastModification = showMimeTypeSize = False
|
||||||
sizeField = 'quotaBytesUsed'
|
sizeField = 'quotaBytesUsed'
|
||||||
summary = FILECOUNT_SUMMARY_NONE
|
summary = FILECOUNT_SUMMARY_NONE
|
||||||
summaryUser = FILECOUNT_SUMMARY_USER
|
summaryUser = FILECOUNT_SUMMARY_USER
|
||||||
summaryMimeTypeInfo = {}
|
summaryMimeTypeInfo = {}
|
||||||
fileIdEntity = {}
|
fileIdEntity = {}
|
||||||
addCSVData = {}
|
addCSVData = {}
|
||||||
|
summaryLastModification = {
|
||||||
|
'lastModifiedFileId': '', 'lastModifiedFileName': '',
|
||||||
|
'lastModifyingUser': '', 'lastModifiedTime': NEVER_TIME}
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if csvPF and myarg == 'todrive':
|
if csvPF and myarg == 'todrive':
|
||||||
@@ -56221,6 +56238,8 @@ def printShowFileCounts(users):
|
|||||||
showSize = True
|
showSize = True
|
||||||
elif myarg == 'sizefield':
|
elif myarg == 'sizefield':
|
||||||
sizeField = getChoice(SIZE_FIELD_CHOICE_MAP, mapChoice=True)
|
sizeField = getChoice(SIZE_FIELD_CHOICE_MAP, mapChoice=True)
|
||||||
|
elif myarg == 'showlastmodification':
|
||||||
|
showLastModification = True
|
||||||
elif myarg == 'showmimetypesize':
|
elif myarg == 'showmimetypesize':
|
||||||
showMimeTypeSize = showSize = True
|
showMimeTypeSize = showSize = True
|
||||||
elif myarg == 'summary':
|
elif myarg == 'summary':
|
||||||
@@ -56252,6 +56271,8 @@ def printShowFileCounts(users):
|
|||||||
sortTitles = ['User', 'id', 'name', 'Total', 'Item cap'] if fileIdEntity.get('shareddrive') else ['User', 'Total']
|
sortTitles = ['User', 'id', 'name', 'Total', 'Item cap'] if fileIdEntity.get('shareddrive') else ['User', 'Total']
|
||||||
if showSize:
|
if showSize:
|
||||||
sortTitles.insert(sortTitles.index('Total')+1, 'Size')
|
sortTitles.insert(sortTitles.index('Total')+1, 'Size')
|
||||||
|
if showLastModification:
|
||||||
|
sortTitles.extend(['lastModifiedFileId', 'lastModifiedFileName', 'lastModifyingUser', 'lastModifiedTime'])
|
||||||
if addCSVData:
|
if addCSVData:
|
||||||
sortTitles.extend(sorted(addCSVData.keys()))
|
sortTitles.extend(sorted(addCSVData.keys()))
|
||||||
csvPF.SetTitles(sortTitles)
|
csvPF.SetTitles(sortTitles)
|
||||||
@@ -56269,6 +56290,9 @@ def printShowFileCounts(users):
|
|||||||
else:
|
else:
|
||||||
sharedDriveName = ''
|
sharedDriveName = ''
|
||||||
mimeTypeInfo = {}
|
mimeTypeInfo = {}
|
||||||
|
userLastModification = {
|
||||||
|
'lastModifiedFileId': '', 'lastModifiedFileName': '',
|
||||||
|
'lastModifyingUser': '', 'lastModifiedTime': NEVER_TIME}
|
||||||
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count, query=DLP.fileIdEntity['query'])
|
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count, query=DLP.fileIdEntity['query'])
|
||||||
try:
|
try:
|
||||||
feed = yieldGAPIpages(drive.files(), 'list', 'files',
|
feed = yieldGAPIpages(drive.files(), 'list', 'files',
|
||||||
@@ -56309,7 +56333,15 @@ def printShowFileCounts(users):
|
|||||||
mimeTypeInfo.setdefault(f_file['mimeType'], {'count': 0, 'size': 0})
|
mimeTypeInfo.setdefault(f_file['mimeType'], {'count': 0, 'size': 0})
|
||||||
mimeTypeInfo[f_file['mimeType']]['count'] += 1
|
mimeTypeInfo[f_file['mimeType']]['count'] += 1
|
||||||
mimeTypeInfo[f_file['mimeType']]['size'] += int(f_file.get(sizeField, '0'))
|
mimeTypeInfo[f_file['mimeType']]['size'] += int(f_file.get(sizeField, '0'))
|
||||||
showMimeTypeInfo(user, mimeTypeInfo, sharedDriveId, sharedDriveName, i, count)
|
if showLastModification:
|
||||||
|
if f_file.get('modifiedTime', NEVER_TIME) > userLastModification['lastModifiedTime'] and 'lastModifyingUser' in f_file:
|
||||||
|
userLastModification['lastModifiedFileId'] = f_file['id']
|
||||||
|
userLastModification['lastModifiedFileName'] = _stripControlCharsFromName(f_file['name'])
|
||||||
|
userLastModification['lastModifiedTime'] = f_file['modifiedTime']
|
||||||
|
userLastModification['lastModifyingUser'] = f_file['lastModifyingUser'].get('emailAddress', UNKNOWN)
|
||||||
|
showMimeTypeInfo(user, mimeTypeInfo, sharedDriveId, sharedDriveName, userLastModification, i, count)
|
||||||
|
if showLastModification and userLastModification['lastModifiedTime'] > summaryLastModification['lastModifiedTime']:
|
||||||
|
summaryLastModification = userLastModification.copy()
|
||||||
except (GAPI.invalidQuery, GAPI.invalid, GAPI.badRequest):
|
except (GAPI.invalidQuery, GAPI.invalid, GAPI.badRequest):
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, None], invalidQuery(DLP.fileIdEntity['query']), i, count)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, None], invalidQuery(DLP.fileIdEntity['query']), i, count)
|
||||||
if not continueOnInvalidQuery:
|
if not continueOnInvalidQuery:
|
||||||
@@ -56324,7 +56356,9 @@ def printShowFileCounts(users):
|
|||||||
continue
|
continue
|
||||||
if summary != FILECOUNT_SUMMARY_NONE:
|
if summary != FILECOUNT_SUMMARY_NONE:
|
||||||
showMimeTypeInfo(summaryUser, summaryMimeTypeInfo,
|
showMimeTypeInfo(summaryUser, summaryMimeTypeInfo,
|
||||||
'' if count > 1 else sharedDriveId, '' if count > 1 else sharedDriveName, 0, 0)
|
'' if count > 1 else sharedDriveId,
|
||||||
|
'' if count > 1 else sharedDriveName,
|
||||||
|
summaryLastModification, 0, 0)
|
||||||
if csvPF:
|
if csvPF:
|
||||||
csvPF.writeCSVfile('Drive File Counts')
|
csvPF.writeCSVfile('Drive File Counts')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user