Groups
Groups

Help Needed: Fetching File Links with GAM Command

179 views
Skip to first unread message

Mahalakshmi K

unread,
Jun 10, 2024, 1:43:14 AM6/10/24
to google-ap...@googlegroups.com

Hello All,

I would like to inquire if it's possible to retrieve all the file links from a specific folder using the GAM command. Could you please assist me with the command required for this task?

For example, I have folders containing numerous files, and I need to fetch the links for those files. I have the folder ID available.

Thank you for your assistance.

Ross Scroggs

unread,
Jun 10, 2024, 10:19:27 AM6/10/24
to google-ap...@googlegroups.com
Advanced GAM


gam redirect csv ./UserFiles.csv user user@domain,com print filelist select <FolderID> fields id,name,mimetype

Add additional fields if desired. Do you want the file paths? if so add a separate argument (not a field): filepath

Ross

--
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/CAAgFZevJH9AUXRHz9VqQdEGWqxSQZZG1dwMPU0SkMHFqQncMvQ%40mail.gmail.com.


--

Mahalakshmi K

unread,
Jun 10, 2024, 11:02:54 AM6/10/24
to google-ap...@googlegroups.com
Hello Ross,

Thanks for the details.

I am unable to configure  Advanced GAM on my Chromebook. It got stuck after a certain step and I'm not able to proceed with the configuration. I have tried using different email super admin IDs, but I am still facing the same issue. However, the authentication was completed. 

Please see the screenshot below.

image.png

image.png

Ross Scroggs

unread,
Jun 10, 2024, 11:10:46 AM6/10/24
to google-ap...@googlegroups.com
Send me a Met/Zoom invitation and I'll help.

Ross



--

Mahalakshmi K

unread,
Jun 10, 2024, 11:18:21 AM6/10/24
to google-ap...@googlegroups.com
Please join:
GAM Config Issue
Monday, June 10 · 8:45 – 9:45pm
Time zone: Asia/Kolkata
Google Meet joining info
Video call link: https://meet.google.com/ppg-iccj-hmz
Or dial: ‪(US) +1 254-863-1593‬ PIN: ‪507 700 321‬#
More phone numbers: https://tel.meet/ppg-iccj-hmz?pin=3523158509703

Mahalakshmi K

unread,
Jun 10, 2024, 11:21:19 AM6/10/24
to google-ap...@googlegroups.com, ross.s...@gmail.com
Please join:
GAM Config Issue
Monday, June 10 · 8:45 – 9:45pm
Time zone: Asia/Kolkata
Google Meet joining info
Video call link: https://meet.google.com/ppg-iccj-hmz
Or dial: ‪(US) +1 254-863-1593‬ PIN: ‪507 700 321‬#
More phone numbers: https://tel.meet/ppg-iccj-hmz?pin=3523158509703


Mahalakshmi K

unread,
Jun 10, 2024, 11:43:50 AM6/10/24
to google-ap...@googlegroups.com, ross.s...@gmail.com
Hello Ross,

Thank you for your valuable time during our meeting. Your help is greatly appreciated.

Mahalakshmi K

unread,
Jun 11, 2024, 9:46:03 AM6/11/24
to Ross Scroggs, google-ap...@googlegroups.com

Hello Ross,

I am currently using the following GAM command to redirect a CSV file and print file lists for individual users:

gam redirect csv ./UserFiles.csv user user@domain.com print filelist select <folderId> fields id,name,mimetype,webviewlink,parents showparentsidsaslist

This command works perfectly for individual users. However, when I attempt to use it for multiple users and folder IDs, the results only display for one particular user. Here is the modified command I used:

gam csv folderid.csv gam redirect csv ./UserFiles.csv user ~owner print filelist select ~folderid fields id,name,mimetype,webviewlink,parents showparentsidsaslist

I then further modified the command as follows:

gam csv bulk.csv gam user ~owner print filelist select ~fid fields id,name,mimetype,webviewlink,parents showparentsidsaslist todrive

This command works and shows all results, but the output is split into different sheets (one for each user and folder ID). For example, if I provide three user and folder IDs, it creates three separate sheets.

Is there any way to modify the command to get the results in a single sheet?

Thank you for your assistance.


On Tue, Jun 11, 2024 at 11:59 AM Mahalakshmi K <mahala...@demo.econz.net> wrote:
Hello,

Sorry for the late reply.

Let me test it out and confirm.




On Mon, Jun 10, 2024 at 10:19 PM Ross Scroggs <ross.s...@gmail.com> wrote:
Add these to the fields list: ,webviewlink,parents
Add this to the end of the command: showparentsidsaslist

Ross

On Mon, Jun 10, 2024 at 9:02 AM Mahalakshmi K <mahala...@demo.econz.net> wrote:
Hi Ross,

Thank you for providing the command, it is working perfectly.

I would like to add extra columns to the CSV file, specifically the link to the file and the folder ID. Could you please guide me on how to do that?

Additionally, is there a way to perform this action in bulk?

Thanks in advance for your assistance.

Best regards,
Mahalakshmi K

On Mon, Jun 10, 2024 at 9:16 PM Mahalakshmi K <mahala...@demo.econz.net> wrote:
I am going to try it. Let me test it out and confirm.

On Mon, Jun 10, 2024 at 9:15 PM Ross Scroggs <ross.s...@gmail.com> wrote:
Is this working?


--

Maj Marshall Giguere

unread,
Jun 11, 2024, 12:02:46 PM6/11/24
to google-ap...@googlegroups.com
I think I understand what you want. and that is all the files listed in a single CSV file. Your friend here is "multiprocess", this will put the output from each individual "print filelist" call to a single CSV file.  Example:

Assuming your input CSV file, "Users.csv" has two columns named "user" and "folderId" respectively and you want all the file listings in a single CSV called "FileList.csv".


> gam redirect csv ./FileList.csv multiprocess csv ./Users.csv gam user "~user" print filelist select "~folderId" fields id,name,mimetype,parents filepath

Hope this is helpful.

Mahalakshmi K

unread,
Jun 11, 2024, 12:14:47 PM6/11/24
to google-ap...@googlegroups.com
Thanks for your help! Yes, the command below is working. I received confirmation a few hours ago.

gam redirect csv ./UserFiles.csv multiprocess csv folderid.csv gam user ~owner print filelist select ~folderid fields id,name,mimetype,webviewlink,parents showparentsidsaslist

gam redirect csv - multiprocess todrive csv bulk.csv gam user ~owner print filelist select ~fid fields id,name,mimetype,webviewlink,parents showparentsidsaslist

Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu