4 Replies Latest reply on Mar 3, 2017 7:38 AM by tpk1982

    How to get rid of hidden folders

    tpk1982 Level 4

      Hi,

       

      I need to report if the link folder contains any subfolder or not. The below coding is working fine but in some files it shows some folder names but when i see the parent link folder then it is not visible. How to ignore the hidden folders. Is it the method i used is correct? Because some times it show the result wrongly.

       

      var inputFolder = Folder(app.activeDocument.allGraphics[0].itemLink.filePath).parent;
      var fileList = inputFolder.getFiles(); 
      var myArray=[]
      flag=0;
      for(i=0;i<fileList.length;i++){
      var myfile=fileList[i];
          if(myfile.name==".DS_Store") continue;  
          if((myfile instanceof Folder) && (!myfile.hidden)){
              myArray.push(myfile);
              if(myArray.length>0){flag=1;}
          }
      }
      
      
      
      
      if(flag==1){alert("ERROR: Some SubFolder(s) present in the Link Folder. "+ "Name and Path of SubFolder(s)\n"+decodeURI(myArray.join("\n")))}
      if(flag==0){alert("No SubFolder(s) present in the Link Folder")}
      

       

      Also is it any other method we can use to achieve my need?

       

      Thanks,

      K