Google Apps Script to unshare files and folders with someone and make a copy of them.
- Unshare all files and folders with someone.
- Unshare a folder (incl. subfiles and subfolders) with someone.
- Transfer ownership: copy all files and folders owned by someone while unsharing them with that someone becoming the owner of them.
- Go to https://script.google.com/start and make sure you're signed in with the Google Drive account you want to use for this.
- Copy & Paste the
Code.gs
in this repository into the default file and select themain
function under "Select function" - In the code, set the
userEmail
variable to the email address of the user you want unshare items with and optionally setcopyNotOwned
variable totrue
if you want to also copy the items. If you want to unshare a specific folder (incl. subfolders and subfiles), set thefolderId
variable (everything after https://drive.google.com/drive/folders/ of the folder URL). - Hit run! (You will probably also be prompted grant permission to your drive so do that)