6 Replies Latest reply on Apr 22, 2015 9:55 AM by Philip Cord

    Catch wrong file name in a folder by script

    suresh0208

      Hi,

       

      I want to write a code for to catch only in file name at the end.

       

      I tried to write my script like this:

      #target photoshop

      var myInputFolder = Folder.selectDialog ("INPUT");

      if(myInputFolder!=null){

          var myFiles = myInputFolder.getFiles(/\.(jpg|psd|tif|png|gif)$/i);

          for(var fileIndex=0;fileIndex<myFiles.length;fileIndex++)

          {

              var currentFile = myFiles[fileIndex];

              if(currentFile instanceof File)

              {

                      if(currentFile.hidden) continue;

                          var doc = app.open(currentFile);

       

              myDoc = doc.name;

              value = myDoc.slice(8,-4);

              if(value !=10)

              {

                  alert(" File naming conversion should be -10");

              }

       

      //Here i want to write some more code

      }

      }

      }

       

      here i want to write if value is in between 10 to 19(E.g., 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) the code should skip the alert. How to write the code.

       

       

      Thanks in advance,

       

      12345664.JPG

      Suresh.N