mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Added option copysubfilesownedby any|me|others to `gam <UserTypeEntity> copy drivefile
This commit is contained in:
@@ -10,6 +10,12 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
|||||||
|
|
||||||
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
|
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
|
||||||
|
|
||||||
|
### 6.66.15
|
||||||
|
|
||||||
|
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
||||||
|
specification of which source folder sub files to copy based on file ownership; the default is `all`.
|
||||||
|
This only applies when files are being copied from a 'My Drive'.
|
||||||
|
|
||||||
### 6.66.14
|
### 6.66.14
|
||||||
|
|
||||||
Updated `gam <UserTypeEntity> modify messages` to recognize the following error:
|
Updated `gam <UserTypeEntity> modify messages` to recognize the following error:
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||||
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
|
admin@server:/Users/admin/bin/gamadv-xtd3$ ./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 6.66.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.10.8 64-bit final
|
Python 3.10.8 64-bit final
|
||||||
MacOS High Sierra 10.13.6 x86_64
|
MacOS High Sierra 10.13.6 x86_64
|
||||||
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
|
|||||||
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
||||||
C:\GAMADV-XTD3>gam version
|
C:\GAMADV-XTD3>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 6.66.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
Windows-10-10.0.17134 AMD64
|
Windows-10-10.0.17134 AMD64
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
|
|||||||
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
||||||
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
||||||
[filemimetype [not] <MimeTypeList>]
|
[filemimetype [not] <MimeTypeList>]
|
||||||
|
[copysubfilesownedby any|me|others]
|
||||||
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
||||||
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
||||||
<DriveFileCopyAttribute>*
|
<DriveFileCopyAttribute>*
|
||||||
@@ -148,6 +149,11 @@ You can specify `<RegularExpression>` patterns that limit the items copied based
|
|||||||
* `foldernamematchpattern <RegularExpression>` - Only folders whose name matches `<RegularExpression>` are copied
|
* `foldernamematchpattern <RegularExpression>` - Only folders whose name matches `<RegularExpression>` are copied
|
||||||
* `shortcutnamematchpattern <RegularExpression>` - Only shortcuts whose name matches `<RegularExpression>` are copied
|
* `shortcutnamematchpattern <RegularExpression>` - Only shortcuts whose name matches `<RegularExpression>` are copied
|
||||||
|
|
||||||
|
### By default, when copying sub files, all files, regardless of ownership, are copied.
|
||||||
|
* `copysubfilesownedby all` - All files, regardless of ownership, are copied.
|
||||||
|
* `copysubfilesownedby me` - Only files owned by `<UserTypeEntity>` are copied.
|
||||||
|
* `copysubfilesownedby others` - Only files not owned by `<UserTypeEntity>` are copied.
|
||||||
|
|
||||||
### Specify a new name for the file/folder
|
### Specify a new name for the file/folder
|
||||||
* `newfilename <DriveFileName>` - The copied file/folder will be named `<DriveFileName>`
|
* `newfilename <DriveFileName>` - The copied file/folder will be named `<DriveFileName>`
|
||||||
* If `stripnameprefix <String>` is specified, `<String>` will be stripped from the front of `<DriveFileName>`
|
* If `stripnameprefix <String>` is specified, `<String>` will be stripped from the front of `<DriveFileName>`
|
||||||
|
|||||||
@@ -204,6 +204,9 @@ You can also replace ` ` with `-` but it doesn't seem to be required.
|
|||||||
|
|
||||||
* `query "label:Foo -Bar-"` - Select messages with label `Foo (Bar)`
|
* `query "label:Foo -Bar-"` - Select messages with label `Foo (Bar)`
|
||||||
|
|
||||||
|
You can have GAM do the substitutions for you with the `matchlabel <LabelName>` option.
|
||||||
|
* `matchlabel "Foo (Bar)"` is converted to `query "label:Foo -Bar-"`
|
||||||
|
|
||||||
## Draft messages
|
## Draft messages
|
||||||
Add a draft message to a user's mailbox.
|
Add a draft message to a user's mailbox.
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
Print the current version of Gam with details
|
Print the current version of Gam with details
|
||||||
```
|
```
|
||||||
gam version
|
gam version
|
||||||
GAMADV-XTD3 6.66.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -16,7 +16,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 6.66.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -28,7 +28,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 6.66.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.66.15 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@@ -65,7 +65,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: 6.66.14
|
Latest: 6.66.15
|
||||||
echo $?
|
echo $?
|
||||||
1
|
1
|
||||||
```
|
```
|
||||||
@@ -73,7 +73,7 @@ echo $?
|
|||||||
Print the current version number without details
|
Print the current version number without details
|
||||||
```
|
```
|
||||||
gam version simple
|
gam version simple
|
||||||
6.66.14
|
6.66.15
|
||||||
```
|
```
|
||||||
In Linux/MacOS you can do:
|
In Linux/MacOS you can do:
|
||||||
```
|
```
|
||||||
@@ -83,7 +83,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 6.66.14 - https://github.com/taers232c/GAMADV-XTD3
|
GAM 6.66.15 - https://github.com/taers232c/GAMADV-XTD3
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
|
|||||||
@@ -6006,7 +6006,9 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
|
|||||||
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
||||||
[<DriveFileParentAttribute>]
|
[<DriveFileParentAttribute>]
|
||||||
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
||||||
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>] [filemimetype [not] <MimeTypeList>]
|
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
||||||
|
[filemimetype [not] <MimeTypeList>]
|
||||||
|
[copysubfilesownedby any|me|others]
|
||||||
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
||||||
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
||||||
<DriveFileCopyAttribute>*
|
<DriveFileCopyAttribute>*
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
Merged GAM-Team version
|
Merged GAM-Team version
|
||||||
|
|
||||||
|
6.66.15
|
||||||
|
|
||||||
|
Added option `copysubfilesownedby any|me|others` to `gam <UserTypeEntity> copy drivefile` that allows
|
||||||
|
specification of which source folder sub files to copy based on file ownership; the default is `all`.
|
||||||
|
This only applies when files are being copied from a 'My Drive'.
|
||||||
|
|
||||||
6.66.14
|
6.66.14
|
||||||
|
|
||||||
Updated `gam <UserTypeEntity> modify messages` to recognize the following error:
|
Updated `gam <UserTypeEntity> modify messages` to recognize the following error:
|
||||||
|
|||||||
@@ -55263,6 +55263,7 @@ def initCopyMoveOptions(copyCmd):
|
|||||||
'shortcutNameMatchPattern': None,
|
'shortcutNameMatchPattern': None,
|
||||||
'fileMimeTypes': set(),
|
'fileMimeTypes': set(),
|
||||||
'notMimeTypes': False,
|
'notMimeTypes': False,
|
||||||
|
'copySubFilesOwnedBy': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
DUPLICATE_FILE_CHOICES = {
|
DUPLICATE_FILE_CHOICES = {
|
||||||
@@ -55378,6 +55379,8 @@ def getCopyMoveOptions(myarg, copyMoveOptions):
|
|||||||
copyMoveOptions['notMimeTypes'] = checkArgumentPresent('not')
|
copyMoveOptions['notMimeTypes'] = checkArgumentPresent('not')
|
||||||
for mimeType in getString(Cmd.OB_MIMETYPE_LIST).lower().replace(',', ' ').split():
|
for mimeType in getString(Cmd.OB_MIMETYPE_LIST).lower().replace(',', ' ').split():
|
||||||
copyMoveOptions['fileMimeTypes'].add(validateMimeType(mimeType))
|
copyMoveOptions['fileMimeTypes'].add(validateMimeType(mimeType))
|
||||||
|
elif myarg == 'copysubfilesownedby':
|
||||||
|
copyMoveOptions['copySubFilesOwnedBy'] = getChoice(SHOW_OWNED_BY_CHOICE_MAP, mapChoice=True)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -56100,7 +56103,7 @@ def copyDriveFile(users):
|
|||||||
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
|
|
||||||
def _checkChildCopyAllowed(childMimeType, childName):
|
def _checkChildCopyAllowed(childMimeType, childName, child):
|
||||||
if childMimeType == MIMETYPE_GA_FOLDER:
|
if childMimeType == MIMETYPE_GA_FOLDER:
|
||||||
if not copyMoveOptions['copySubFolders']:
|
if not copyMoveOptions['copySubFolders']:
|
||||||
return False
|
return False
|
||||||
@@ -56112,6 +56115,9 @@ def copyDriveFile(users):
|
|||||||
else:
|
else:
|
||||||
if not copyMoveOptions['copySubFiles']:
|
if not copyMoveOptions['copySubFiles']:
|
||||||
return False
|
return False
|
||||||
|
if copyMoveOptions['copySubFilesOwnedBy'] is not None:
|
||||||
|
if child.get('driveId', None) is None and child.get('ownedByMe', False) != copyMoveOptions['copySubFilesOwnedBy']:
|
||||||
|
return False
|
||||||
if copyMoveOptions['fileMimeTypes']:
|
if copyMoveOptions['fileMimeTypes']:
|
||||||
if not copyMoveOptions['notMimeTypes']:
|
if not copyMoveOptions['notMimeTypes']:
|
||||||
if childMimeType not in copyMoveOptions['fileMimeTypes']:
|
if childMimeType not in copyMoveOptions['fileMimeTypes']:
|
||||||
@@ -56143,7 +56149,7 @@ def copyDriveFile(users):
|
|||||||
q=WITH_PARENTS.format(folderId),
|
q=WITH_PARENTS.format(folderId),
|
||||||
orderBy='folder desc,name,modifiedTime desc',
|
orderBy='folder desc,name,modifiedTime desc',
|
||||||
fields='nextPageToken,files(id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
fields='nextPageToken,files(id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
||||||
'description,folderColorRgb,mimeType,modifiedTime,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare,'\
|
'description,folderColorRgb,mimeType,modifiedTime,ownedByMe,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare,'\
|
||||||
'shortcutDetails(targetId,targetMimeType))',
|
'shortcutDetails(targetId,targetMimeType))',
|
||||||
pageSize=GC.Values[GC.DRIVE_MAX_RESULTS], **sourceSearchArgs)
|
pageSize=GC.Values[GC.DRIVE_MAX_RESULTS], **sourceSearchArgs)
|
||||||
kcount = len(sourceChildren)
|
kcount = len(sourceChildren)
|
||||||
@@ -56169,10 +56175,11 @@ def copyDriveFile(users):
|
|||||||
if childId in copiedTargetFiles: # Don't recopy file/folder copied into a sub-folder
|
if childId in copiedTargetFiles: # Don't recopy file/folder copied into a sub-folder
|
||||||
continue
|
continue
|
||||||
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
||||||
if not _checkChildCopyAllowed(childMimeType, childName):
|
if not _checkChildCopyAllowed(childMimeType, childName, child):
|
||||||
if not suppressNotSelectedMessages:
|
if not suppressNotSelectedMessages:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_SELECTED, k, kcount)
|
entityActionNotPerformedWarning(kvList, Msg.NOT_SELECTED, k, kcount)
|
||||||
continue
|
continue
|
||||||
|
child.pop('ownedByMe', None)
|
||||||
trashed = child.pop('trashed', False)
|
trashed = child.pop('trashed', False)
|
||||||
if (childId == newFolderId) or (excludeTrashed and trashed):
|
if (childId == newFolderId) or (excludeTrashed and trashed):
|
||||||
entityActionNotPerformedWarning(kvList,
|
entityActionNotPerformedWarning(kvList,
|
||||||
|
|||||||
Reference in New Issue
Block a user