Delete all files owned by user

117 views
Skip to first unread message

David Clarke

unread,
Sep 26, 2016, 4:08:07 PM9/26/16
to Google Apps Manager
We are using Google Apps for Education to take exams in Google classroom.
We have created a few hundred "Exam accounts" that only have access to Google drive and Google Classroom.  The idea is that the teacher share out the exam questions via classroom then the kids write and then print out their tests.
What I am looking for is a way to clear out the exam account folders after each test.

I tried using:

gam user examacc...@domain.com delete drivefile "query:title='*.gdoc'" purge
gam user examacc...@domain.com delete drivefile "query:title='*" purge
gam user examacc...@domain.com delete drivefile "query:title=*.*'" purge

during testing all of the above come up with no files found even though there are various gdoc files in the folder

the best I could com up with was:

gam user examacc...@domain.com delete drivefile "query:mimeType='application/vnd.google-apps.document'" purge

This works for the most part as it will delete what 'Should" be in their folder, but students being students will sometimes create extra folders or oddly named documents, that the above doesn't catch.

Are there any wildcards that I can use to delete all files in these accounts?

Thanks


Graham Ingleby

unread,
Sep 27, 2016, 5:00:31 AM9/27/16
to GAM group
Hi David

Could you do a query based on the owner? "'examacc...@domain.com' in owners" would seem to do it

Or modified date "modifiedTime < '2200-01-01T12:00:00'" (modified before 1st Jan 2100)

Failing that you have the command to print all a users files to a CSV https://github.com/jay0lee/GAM/wiki/GoogleDriveManagement#managing-google-drive-files-and-folders-for-users, you could then use the CSV to delete each file

Graham

 

 Graham Ingleby | Google for Work Consultant | +44 1344 203395 | ging...@ancoris.com

Google+      

Powered by Ancoris Signatures


--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/6ddfb2d2-2816-44b5-8ce1-c2a87606d8db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



This message is for the named person's use only. If you receive this message in error, please delete it and notify the sender. Ancoris reserves the right to monitor all e-mail communications through its networks. Ancoris Limited, Registered in England Number: 04830784, Registered address: 5a Frascati Way, Maidenhead, Berkshire SL6 4UY. Trading Address: Lily Hill House, Lily Hill Road, Bracknell, Berkshire RG12 2SJ




Reply all
Reply to author
Forward
0 new messages