如何创建Google脚本以按参数从文件夹路径中查找文件?

时间:2017-11-27 23:40:54

标签: javascript file google-apps-script google-sheets directory

我的驱动器有一个文件夹列表。其中一些文件夹与我共享。例如:

/images
    logo.PNG
    mimdmap.jpg
/projects (shared)
    /webproject1
        doc1.doc
        finance_2017.xlsx

我想创建一个函数如下:

function listFolderFiles(path, file, callback){
var founded = false;
//google drive validate if entire folder exist
var pathCheck = ?

    If(pathCheck == false){
        return callback (false);
    }else{
  //google drive script to return files list object 
        var filesList = ?
        //loop to find file
      for(var i=0;i<filesList.size();i++){
            if(filesList[0].name == file){
                founded = true;
            }
        }
 return callback(founded)
}

listFolderFiles("/projects/webproject1", "doc1.doc", function (ret){
Looger.log(ret);
});

0 个答案:

没有答案