3 Replies Latest reply on Jul 15, 2014 7:23 AM by Dapeamel

    Copy all indd files to a specific location

    Dapeamel Level 1

      Hello guys I have no idea why my script doesn't work the way I want,

       

      I want my script to work this way,  when I pick a folder from the dialog my script choose all the .indd files

      and put them in a specific location

       

       

      See code below

       

       

       

      var myFolder = Folder.selectDialog ('Choose a Folder');
      $.writeln('-------------------------------\r' + myFolder.displayName + '\r-------------------------------\r');
      if(myFolder != null){
        var myFiles = myFolder.getFiles('*.indd');
        for (i = 0; i < myFiles.length; i++)
        {
        var myFile = myFiles[i];
        // myTargetFolder = "/Kommuni/LaRe/LareAUTO/341542" // put files here
      
      
      
      myFiles[i].copy ("/Kommuni/LaRe/LareAUTO/341542/");
      
      
      // $.writeln(myFile.displayName);  // just for write the data in console
        }
      }
      
      
      
      

       

       

      Can someone help me to put a correct code here

       

      Thank you in advance

       

      Cheers all members