Move files based on MIME Type and BETWEEN dates

34 views
Skip to first unread message

James SEYMOUR

unread,
Aug 30, 2023, 9:16:16 PM8/30/23
to GAM for Google Workspace
I have folder that contains subfolders and files. I would like to move all files created bewteen 2 dates from the folder to a subfolder. And if possible limit this to a specific MIME type, such as spreadsheets.

I am struggling with the correct syntax and command to use.

Is anyone able to assist with this?

Cheers

James

Ross Scroggs

unread,
Aug 30, 2023, 9:19:54 PM8/30/23
to google-ap...@googlegroups.com
James,


Send me a Meet/zoom invitation and we'll work in the details

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/9f2fc3f8-9eb8-4d36-bd68-6c7f2bf13cf8n%40googlegroups.com.

James SEYMOUR

unread,
Aug 30, 2023, 9:36:32 PM8/30/23
to GAM for Google Workspace
Cheers, Ross. I have sent a Meet link.

James SEYMOUR

unread,
Aug 30, 2023, 10:48:15 PM8/30/23
to GAM for Google Workspace
Many thanks Ross. The solution was 'easy' as all the files to be moved were in a single folder and not in multiple folders.

To Test
gam redirect csv ./sheets.csv user <Owner Email Addreess> print filelist query " '<Parent Folder ID>' in parents and  mimeType='application/vnd.google-apps.spreadsheet' and createdTime>='2022-08-01T00:00:00+08:00' and createdTime<'2023-07-31T00:00:00+08:00' " fields id,name,mimetype fullpath

You can then view the sheets.csv file to make sure that these are the files you want to move. Note, the +08:00 is used as my time zone is GMT+8.

To Move
gam user <Owner Email Addreess> update drivefile query " '<Parent Folder ID>' in parents and  mimeType='application/vnd.google-apps.spreadsheet' and createdTime>='2022-08-01T00:00:00+08:00' and createdTime<'2023-07-31T00:00:00+08:00' " parentid <Destination Folder ID>
Reply all
Reply to author
Forward
0 new messages