1 Reply Latest reply on Apr 3, 2016 11:10 PM by b91823603

    [JS] How to get folder count?

    K159 Level 1



      I want to get a number of folders for a specific directory.





      var folderCount = Folder("C:/test/file/").getFiles( ? );    // Is this what values need?






      If this method is wrong, please tell me the other way.



        • 1. Re: [JS] How to get folder count?
          b91823603 Level 3



          Get all files from folder and then check whether it is a file or folder. Try this one


          var myFileList = Folder("D:/Test").getFiles();

          var folderCount = GetFoldersCount(myFileList) ;



          function GetFoldersCount(fileList)


              var folderCount = 0;

              for (var i = 0; i < fileList.length; i++)


                  var myFile = myFileList[i]; 

                  if (myFile instanceof Folder) 



              return folderCount