How to get subfolder indesign files
hi experts
how can tell script want subfolders not sub sub folder or sub sub sub...folder files.
my script this:
function getfiles(thefolder) {
var files = [],
filelist = thefolder.getfiles(),
i, file;
(i = 0; < filelist.length; i++) {
file = filelist[i];
if (file instanceof folder) {
files = files.concat(getfiles(file));
}
else if (file instanceof file && file.name.match(/\.indd$/i)) {
files.push(file);
}
}
return files;
}
how can change it?
thanks
regard
john
hi john,
try code..
var files = [],file,flag=0; var thefolder = folder.selectdialog ("select folder"); alert((getfiles(thefolder)).join("\n")); function getfiles(thefolder) { filelist = thefolder.getfiles(); (i = 0; < filelist.length; i++) { file = filelist[i]; if (file instanceof folder) { if(flag==0){ flag=1; getfiles(file); } } else if (file instanceof file && file.name.match(/\.indd$/i)) { files.push(file); } } return files; }
-yajiv
More discussions in InDesign Scripting
adobe
Comments
Post a Comment