TravelWhere
TravelWhere

Reputation: 369

Is there a easy way to bulk set subfolder permissions in google drive?

I have a folder that contains over 1000 subfolders. I want to set the permission to shared to all the subfolders so I tried selecting all and right click then get share link but it didn't work cause it gave error: Too many files

Is there another way to set all the subfolders to shared?

Upvotes: 1

Views: 3710

Answers (2)

Micha
Micha

Reputation: 41

Setting permission on the parent folder will set permissions on its contents, including subfolders. If you have mixed settings where subfolders or files do not have the same permissions as the top parent folder you could revoke the permission on the parent folder, then recreate the share setting which will "refresh" permission on all contents.

You could also use a function. For example, to make a folder and all its contents public:

function makeFolderPublic(parentFolderID) {
  var shareThisFolder = DriveApp.getFolderById(parentFolderID);
  shareThisFolder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW); // make folder and all its contents public
}

Upvotes: 2

Cooper
Cooper

Reputation: 64032

I think this will give anyone readonly access

To all of the subfolders under the parentFolder with the Id that you put into where it says 'Your Folder ID'.

function shareFolders() {
  var parentFolder=DriveApp.getFolderById('Your Folder ID');
  var subfolders=parentFolder.getFolders();
  while(subfolders.hasNext()) {
    var subfolder=subfolders.next();
    subfolder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW);
  }
}

I don't have a clue as to how long this will take for 1000 sub folders.

Upvotes: 0

Related Questions