如何按访问级别列出我在Google云端硬盘中的项目?


11

我发现自己不小心在Google云端硬盘中共享敏感信息。这已经发生了多次。所以我想检查一下我分享的内容以及与谁分享的内容。我想在云端硬盘中查看我的项目(文件和文件夹)的列表,并按访问级别排序:首先是公开,然后是具有链接的人员,然后是与特定人员共享,最后是私有。那可能吗?

还是有其他方法可以实现这一目标?

这个问题也适用于Dropbox,为此我建议了一个单独的问题


做完了 我用另一个问题的链接更新了这个问题,反之亦然。
Vaddadi Kartick '16

Answers:


1

该脚本将使您非常接近该目标。这是output的示例

目前已将其设置为在特定文件夹和子文件夹上运行,但是您可以对其进行修改以在整个驱动器上运行(取决于它可能超时的文件数量)。

  1. 打开一个新的电子表格。
  2. 到了 Tools>Script Editor
  3. 将下面的脚本复制并粘贴到该窗口中,以替换所有内容
  4. 将您的文件夹ID代替 THE_FOLDER_ID
  5. 保存。
  6. 通过点击播放(运行)按钮运行脚本
  7. 去看看它在电子表格上写了什么,然后根据需要进行排序。

    function listFolders(folder) {
    var sheet = SpreadsheetApp.getActiveSheet();
    sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
    var folder = DriveApp.getFolderById("THE_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
    
    var files = folder.getFiles();//initial loop on loose files w/in the folder
    
     var cnt = 0;
     var file;
    
     while (files.hasNext()) {
         var file = files.next();
         var listEditors = file.getEditors(); //gets the editor email(s), doesn't show your own as it's assumed
         var editors = [];
         for (var cnt = 0; cnt < listEditors.length; cnt++) {
             editors.push(listEditors[cnt].getEmail());
             Logger.log(editors);
         };
         var listViewers = file.getViewers(); //gets the viewer email(s)
         var viewers = [];
         for (var cnt = 0; cnt < listViewers.length; cnt++) {
             viewers.push(listViewers[cnt].getEmail());
             Logger.log(viewers);
         }
         cnt++;  //data chunk pushes all the file info to the ss
    
         data = [
             file.getName(),
             file.getSharingAccess(),
             file.getSharingPermission(),
             editors.toString(),
             viewers.toString(),
             file.getDateCreated(),
             file.getSize(),
             file.getUrl(),
             "https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + file.getId(),
             file.getDescription(),
             file.getMimeType(),
         ];
    
         sheet.appendRow(data);
    
     };
    
    
     var subfolders = folder.getFolders(); //same thing as above but for all the subfolders in the folder
    
     while (subfolders.hasNext()) {
         //Logger.log(folder);
         var name = subfolders.next();
    
         var files = name.getFiles();
    
         var cnt = 0;
         var file;
    
         while (files.hasNext()) {
             var file = files.next();
             var listEditors = file.getEditors();
             var editors = [];
             for (var cnt = 0; cnt < listEditors.length; cnt++) {
                 editors.push(listEditors[cnt].getEmail());
                 Logger.log(editors);
             };
             var listViewers = file.getViewers();
             var viewers = [];
             for (var cnt = 0; cnt < listViewers.length; cnt++) {
                 viewers.push(listViewers[cnt].getEmail());
                 Logger.log(viewers);
             }
             cnt++;
    
             data = [
                 file.getName(),
                 file.getSharingAccess(),
                 file.getSharingPermission(),
                 editors.toString(),
                 viewers.toString(),
                 file.getDateCreated(),
                 file.getSize(),
                 file.getUrl(),
                 "https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + file.getId(),
                 file.getDescription(),
                 file.getMimeType(),
             ];
    
             sheet.appendRow(data);
    
             };
     }
    

    }

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.