Guest User

Subfolders

a guest
Nov 26th, 2012
246
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var myFolder = Folder.selectDialog("Select your folder containing the files", "");
  2. f = find_files(myFolder);
  3.  
  4. function find_files (dir)
  5.     {
  6.     return find_files_sub (dir, []);
  7.     }
  8.  
  9. function find_files_sub (dir, array)
  10.     {
  11.     var f = Folder (dir).getFiles ("*.*");
  12.     for (var i = 0; i < f.length; i++)
  13.         {
  14.         if (f[i] instanceof Folder)
  15.             find_files_sub (f[i], array);
  16.         else
  17.             if (f[i].name.slice (-3).toLowerCase() == ".ai")
  18.                 array.push (f[i]);
  19.         }
  20.     return array;
  21.     }
RAW Paste Data