Google apps script 移动文件时,脚本首先选择哪个文件?
我有一个GoogleApps脚本,可以将一个GoogleDrive文件移动到另一个GoogleDrive地图。由于基于时间的触发器,每4小时发生一次。有人知道它选择移动哪个文件吗?文件具有随机名称,因此应随机移动。但是,脚本似乎只移动最后上载的文件 对于上下文:我将脚本与IFTTT结合使用 试试这个:Google apps script 移动文件时,脚本首先选择哪个文件?,google-apps-script,Google Apps Script,我有一个GoogleApps脚本,可以将一个GoogleDrive文件移动到另一个GoogleDrive地图。由于基于时间的触发器,每4小时发生一次。有人知道它选择移动哪个文件吗?文件具有随机名称,因此应随机移动。但是,脚本似乎只移动最后上载的文件 对于上下文:我将脚本与IFTTT结合使用 试试这个: function moveRandomly(s,t) { var files=DriveApp.getFolderById(s).getFiles(); var fA=[]; whil
function moveRandomly(s,t) {
var files=DriveApp.getFolderById(s).getFiles();
var fA=[];
while(files.hasNext()){fA.push(files.next().getId());}
var file=DriveApp.getFileById(fA[Math.floor(Math.random()*fA.length)]);
var destination=DriveApp.getFolderById(t);
destination.addFile(file);
var pull=DriveApp.getFolderById("SourceFolderId");
pull.removeFile(file);
}
欢迎来到StackOverFlow,请借此机会参加并学习如何,以及。
function moveRandomly(s,t) {
var files=DriveApp.getFolderById(s).getFiles();
var fA=[];
while(files.hasNext()){fA.push(files.next().getId());}
var file=DriveApp.getFileById(fA[Math.floor(Math.random()*fA.length)]);
var destination=DriveApp.getFolderById(t);
destination.addFile(file);
var pull=DriveApp.getFolderById("SourceFolderId");
pull.removeFile(file);
}