Hi Ashram,
Try this.
var folder = Folder.selectDialog ("Select the root folder"); var myfiles = []; var _layers = ["Job Info", "test1", "test2", "test3"]; getsubfolderfiles(folder); for(var i =0;i<myfiles.length;i++) { var doc = app.open(myfiles[i],false); for(var j=0;j<_layers.length;j++) { try { doc.layers.item(_layers[j]).remove(); } catch(e){} } doc.save(); doc.close(); } function getsubfolderfiles(folder) { var filelist = folder.getFiles(); for(var i =0;i<filelist.length;i++) { if(filelist[i] instanceof Folder) { getsubfolderfiles (filelist[i]); } else if(filelist[i] instanceof File) { if(filelist[i].name.indexOf(".indd") > -1){ myfiles.push(filelist[i]); } } } }
Regards,
Chinna