Answer the question
In order to leave comments, you need to log in
How to transfer photos from one folder to another?
How to transfer photos from one folder to another, but this folder is created every time a new one. I have a script that simply transfers from one folder to another, but is it possible to somehow make this id, say, dynamic or something like that.
function CopyFiles() {
var srcFldr = DriveApp.getFolderById("");
var srcFiles = srcFldr.getFiles();
var desFldr = DriveApp.getFolderById("");
var desFiles = desFldr.getFiles();
var dfnA = [];
while (desFiles.hasNext()) {
var df = desFiles.next();
dfnA.push(df.getName());
}
while (srcFiles.hasNext()) {
var sf = srcFiles.next();
if (dfnA.indexOf(sf.getName()) == -1) {
sf.makeCopy(sf.getName(), desFldr);
}
}
}
Answer the question
In order to leave comments, you need to log in
Specify Parameters for the Function
function copyFiles(fromId, toId) {
var srcFldr = DriveApp.getFolderById(fromId);
var srcFiles = srcFldr.getFiles();
var desFldr = DriveApp.getFolderById(toId);
var desFiles = desFldr.getFiles();
var dfnA = [];
while (desFiles.hasNext()) {
var df = desFiles.next();
dfnA.push(df.getName());
}
while (srcFiles.hasNext()) {
var sf = srcFiles.next();
if (dfnA.indexOf(sf.getName()) == -1) {
sf.makeCopy(sf.getName(), desFldr);
}
}
}
function run(){
copyFiles('ASDFASDFSDF2345234ADSFASDF', 'ASDFSDFasf452345345SAFDF-sagasdfASDF');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question