2 Replies Latest reply on Aug 4, 2014 8:26 AM by kanaga kumar

    Create folder hierarchy and multiple sub folders

    kanaga kumar

      Dear Friends,

       

      I have copied script from "create folder hierarchy" (created from chinna), but i need small modification from their script, I have added the below comment for subfolder created purpose, its also created.

       

      But i need multiple folder created in same hierarchy (see the "my requirement" screen shot)

       

       

      var target = Folder.selectDialog("Choose a target folder"); 

      if(!(Folder(target+"/"+"Folder A")).exists) 

              new Folder(target + "/" + "PRODUCTION" + "/" + "APPL" + "/" + "DD-MM-YY").create(); 

          } 

       

      OUTPUT:

      Screen Shot 2014-08-02 at 4.00.58 PM.png

       

      MY REQUIREMENT IS:

      Screen Shot 2014-08-02 at 4.00.49 PM.png

       

      Thanks in advance:

      kanaga kumar. k

        • 1. Re: Create folder hierarchy and multiple sub folders
          pixxxel schubser Most Valuable Participant

          Hi kanaga kumar,

          there are several ways to do this. With the script logic of chinna you can do something like this:

          var target = Folder.selectDialog("Choose a target folder");
          if(!(Folder(target+"/"+"PRODUKTION")).exists) {
              new Folder(target+"/"+"PRODUKTION").create();
              }
          if(!(Folder(target+"/"+"PRODUKTION"+"/"+"APPL")).exists) {
              new Folder(target+"/"+"PRODUKTION"+"/"+"APPL").create();
              }
          if(!(Folder(target+"/"+"PRODUKTION"+"/"+"FONTS")).exists) {
              new Folder(target+"/"+"PRODUKTION"+"/"+"FONTS").create();
              }
          if(!(Folder(target+"/"+"PRODUKTION"+"/"+"IMAGES")).exists) {
              new Folder(target+"/"+"PRODUKTION"+"/"+"IMAGES").create();
              }
          if(!(Folder(target+"/"+"PRODUKTION"+"/"+"PDF")).exists) {
              new Folder(target+"/"+"PRODUKTION"+"/"+"PDF").create();
              }
          

           

          Have fun

           

          • 2. Re: Create folder hierarchy and multiple sub folders
            kanaga kumar Level 1

            Thanks for your coding, it working nice