mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Allow filtering on modifiedTime in copy drivefile
This commit is contained in:
@@ -6888,6 +6888,7 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
|
|||||||
[skipids <DriveFileEntity>]
|
[skipids <DriveFileEntity>]
|
||||||
[copysubfiles [<Boolean>]] [filenamematchpattern <REMatchPattern>]
|
[copysubfiles [<Boolean>]] [filenamematchpattern <REMatchPattern>]
|
||||||
[filemimetype [not] <MimeTypeList>] [filemimetype category <MimeTypeNameList>]
|
[filemimetype [not] <MimeTypeList>] [filemimetype category <MimeTypeNameList>]
|
||||||
|
[([start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>])|(range <Date>|<Time> <Date>|<Time>)]|
|
||||||
[copysubfilesownedby
|
[copysubfilesownedby
|
||||||
any|me|others|
|
any|me|others|
|
||||||
users <EmailAddressList>|
|
users <EmailAddressList>|
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
7.32.06
|
||||||
|
|
||||||
|
Added options to `gam <UserTypeEntity> copy drivefile ... copysubfiles` to limit copying
|
||||||
|
of files whose `modifiedTime` meets specified requirements.
|
||||||
|
* `start|starttime <Date>|<Time>` - If specified, `modifiedTime` must be >= the value
|
||||||
|
* `end|endtime <Date>|<Time>` - If specified, `modifiedTime` must be <= the value
|
||||||
|
* `range <Date>|<Time> <Date>|<Time>` - first value <= `modifiedTime` <= second value
|
||||||
|
|
||||||
7.32.05
|
7.32.05
|
||||||
|
|
||||||
Fixed bug in `gam <UserTypeEntity> print messages|threads ... headers <SMTPHeaderList>` where
|
Fixed bug in `gam <UserTypeEntity> print messages|threads ... headers <SMTPHeaderList>` where
|
||||||
|
|||||||
@@ -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.32.05'
|
__version__ = '7.32.06'
|
||||||
__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
|
||||||
@@ -61954,6 +61954,8 @@ def initCopyMoveOptions(copyCmd):
|
|||||||
'copySubFilesOwnedBy': {},
|
'copySubFilesOwnedBy': {},
|
||||||
'copyPermissionRoles': set(DRIVEFILE_ACL_ROLES_MAP.values()),
|
'copyPermissionRoles': set(DRIVEFILE_ACL_ROLES_MAP.values()),
|
||||||
'copyPermissionTypes': set(DRIVEFILE_ACL_PERMISSION_TYPES),
|
'copyPermissionTypes': set(DRIVEFILE_ACL_PERMISSION_TYPES),
|
||||||
|
'checkModifiedTime': False,
|
||||||
|
'startEndTime': StartEndTime(),
|
||||||
}
|
}
|
||||||
|
|
||||||
DUPLICATE_FILE_CHOICES = {
|
DUPLICATE_FILE_CHOICES = {
|
||||||
@@ -62112,6 +62114,9 @@ def getCopyMoveOptions(myarg, copyMoveOptions):
|
|||||||
copyMoveOptions['copySubFilesOwnedBy']['value'] = set(getString(Cmd.OB_EMAIL_ADDRESS_LIST).replace(',', ' ').lower().split())
|
copyMoveOptions['copySubFilesOwnedBy']['value'] = set(getString(Cmd.OB_EMAIL_ADDRESS_LIST).replace(',', ' ').lower().split())
|
||||||
elif copyMoveOptions['copySubFilesOwnedBy']['mode'] in {'regex', 'notregex'}:
|
elif copyMoveOptions['copySubFilesOwnedBy']['mode'] in {'regex', 'notregex'}:
|
||||||
copyMoveOptions['copySubFilesOwnedBy']['value'] = getREPattern(re.IGNORECASE)
|
copyMoveOptions['copySubFilesOwnedBy']['value'] = getREPattern(re.IGNORECASE)
|
||||||
|
elif myarg in {'start', 'starttime', 'end', 'endtime', 'range'}:
|
||||||
|
copyMoveOptions['startEndTime'].Get(myarg)
|
||||||
|
copyMoveOptions['checkModifiedTime'] = True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -62668,6 +62673,7 @@ copyReturnItemMap = {
|
|||||||
# notusers <EmailAddressList>|
|
# notusers <EmailAddressList>|
|
||||||
# regex <REMatchPattern>|
|
# regex <REMatchPattern>|
|
||||||
# notregex <REMatchPattern>]
|
# notregex <REMatchPattern>]
|
||||||
|
# [([start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>])|(range <Date>|<Time> <Date>|<Time>)]|
|
||||||
# [copysubfolders [<Boolean>]] [foldernamematchpattern <REMatchPattern>]
|
# [copysubfolders [<Boolean>]] [foldernamematchpattern <REMatchPattern>]
|
||||||
# [copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <REMatchPattern>]
|
# [copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <REMatchPattern>]
|
||||||
# [duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
# [duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
@@ -62904,6 +62910,14 @@ def copyDriveFile(users):
|
|||||||
return False
|
return False
|
||||||
if not copyMoveOptions['mimeTypeCheck'].Check(childMimeType):
|
if not copyMoveOptions['mimeTypeCheck'].Check(childMimeType):
|
||||||
return False
|
return False
|
||||||
|
if copyMoveOptions['checkModifiedTime']:
|
||||||
|
childModifiedTime = child.get('modifiedTime', None)
|
||||||
|
if not childModifiedTime:
|
||||||
|
return False
|
||||||
|
childModifiedTime = formatLocalTime(childModifiedTime)
|
||||||
|
if ((copyMoveOptions['startEndTime'].startTime is not None and childModifiedTime < copyMoveOptions['startEndTime'].startTime) or
|
||||||
|
(copyMoveOptions['startEndTime'].endTime is not None and childModifiedTime > copyMoveOptions['startEndTime'].endTime)):
|
||||||
|
return False
|
||||||
nameMatchPattern = copyMoveOptions['fileNameMatchPattern']
|
nameMatchPattern = copyMoveOptions['fileNameMatchPattern']
|
||||||
return not nameMatchPattern or nameMatchPattern.match(childName)
|
return not nameMatchPattern or nameMatchPattern.match(childName)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user