Find and open files in subfolders

Hi
Simple request I know but I can't manage to find how to make fileArray = targetFolder.getFiles("*.indd"); to access *.indd files inside sub folders and perhaps in sub sub folders..
Can anyone share how to do this?
Thanks in advance, Ken

Here is an example -- this script gets all indesign documents from the selected folder including its subfolders and puts all them into a book.
var myFolder = Folder.selectDialog( "Select a folder with InDesign files" );
if ( myFolder != null ) {
     var myFiles = [];
     GetSubFolders(myFolder);
     if ( myFiles.length > 0 ) {
          var myBookFileName = myFolder + "/"+ myFolder.name + ".indb";
          myBookFile = new File( myBookFileName );
          if ( myBookFile.exists ) {
               if ( app.books.item(myFolder.displayName + ".indb") == null ) {
                    myBook = app.open( myBookFile );
          else {
                myBook = app.books.add( myBookFile );
                myBook.automaticPagination = false;
                for ( i=0; i < myFiles.length; i++ ) {
                    myBook.bookContents.add( myFiles[i] );
                myBook.save();
//=================================== FUNCTIONS =========================================
function GetSubFolders(theFolder) {
     var myFileList = theFolder.getFiles();
     for (var i = 0; i < myFileList.length; i++) {
          var myFile = myFileList[i];
          if (myFile instanceof Folder){
               GetSubFolders(myFile);
          else if (myFile instanceof File && myFile.name.match(/\.indd$/i)) {
               myFiles.push(myFile);
Hope this helps.
Kasyan

Similar Messages

  • My external hard drive is 'seen' by my iMac and I can go into the Finder and open files and folders. I am using the hard drive for Time Machine back up. However Time Machine says it can't find the drive. Same thing has happened with Final Cut Express.

    My new LaCie external hard drive is 'seen' by my iMac and I can go into the Finder and open files and folders. I am using the hard drive for Time Machine back up. However Time Machine says it can't find the drive.
    The same thing happened recently between Final Cut Express and my other LaCie external hard drive used as the Scratch disk. It fixed itself.
    I've run out of ideas. Help would be very much appreciated. Thanks.

    have you done some searches on FCPx and time machine? Is there a known issue with using a TM drive with FCPx? dunno but ...wait...I'll take 60 sec for you cause I'm just that kind of guy....   google...." fcpx time machine problem"  Frist page link 
    http://www.premiumbeat.com/blog/fcpx-bug-best-practices-for-using-external-hard- drives-and-final-cut-pro-x/
           You cannot have time machine backups on your hard drive if you intend to use it in FCPX.
    booya!

  • RW2 preview in finder and "Open file" dialog

    Hello,
    I run into a curiosity with RW2 file format (from LX3 and FZ38). In Finder, RW2 preview is not displayed and only default icon (black icon with text exec in corner). The same RW2 files does have correct preview, when I browse them in "Open file" dialog window (for example Safari > File > Open File...).
    How it is possible the Finder and Open dialog do have different settings? Is it possible to copy these settings?
    Thank You

    see thread http://discussions.apple.com/thread.jspa?messageID=3805971&#3805971
    though no solution yet.

  • Freeze during column view in finder and open file box?

    Whenever I open a file and the open file dialog box is in column view it freezes when I click on the file and the view shifts to reveal the icon and info. It happens a lot in finder too, but not as often. It usually doesn't start happening for a few minutes after I reboot.
    I'm pretty sure quicktime is associated with that icon/image preview. I just formatted my hard drive hoping that would help but it doesn't. I have to force quit applications alot if I forget to get out of column view...someone please help!
    I don't remember this happening before I installed macromedia studio 8, but I'm not sure. I have to use those programs.

    see thread http://discussions.apple.com/thread.jspa?messageID=3805971&#3805971
    though no solution yet.

  • I can't seem to open (view) my photos.  I get an error message that says "the file couldn't be opened because you don't have permission to view it. To view or change permission, select the item in the finder and choose File. Get info."

    I can't seem to open (view) my photos.  I get an error message that says "the file couldn't be opened because you don't have permission to view it. To view or change permission, select the item in the finder and choose File. Get info."  I have never had this happen before?  Thanks!

    Try the following:
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - Run Option #1, Repair Permissions.
    OT

  • When i use view as list in finder and open a folder with many files i cant right click with mouse without selecting or highlighting a file....i just want to right click to paste an item or create a new folder...what can i do?

    When i use view as list in finder and open a folder with many files i cant right click with mouse without selecting or highlighting a file....i just want to right click to paste an item or create a new folder...what can i do?

    Thx for that im gonna try it....but is there a way to do it without using toolbar or cmd-c...? i mean using only the mouse?why does it have to highlight the file even though i click a bit next to it....?using icon view i can right click next to the folder and i wont have a problem but with list view that i prefer using it will highlight the whole row.....and i dont find free space to right click cause i got many files

  • I can not open documents I get a message that says To view or change permissions, select the item in the Finder and choose File Get Info.  help

    I have a mac with os X.  I have saved documents and photos on my computer and am now not able to open them.  I get a message that tells To view or change permissions, select the item in the Finder and choose File > Get Info.  I do that and it is not locked.  confused.  help

    In the Info window it's this:
    Do you have read and write privileges?

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • Finder cannot open files in the "volume" format.

    I had to downgrade from the second Yosemite beta in order to run one of my applications for work that didn't run on Yosemite. I've successful reinstalled Mavericks to the chagrin of finder not working at all. Whenever I mount a DMG I get "Finder cannot open files in the “volume” format." Also, whenever I click to open a folder or a new window in finder, it just crashes and relaunches. I'm going to try to do a fresh install of Mavericks and recover from a backup. Let me know if you guys have faced this same issue and found a solution.
    I also had to regain admin privileges for my user which I have done successfully.

    I fixed my problem by installing Mavericks again. No need to fully restore.

  • Cannot reinstate catalog after returning PC (Windows 7) to factory settings (because of worm infection). Catalog was backed up on external drive but not using PSE backup facility. Cannot find and *.tly file. Is this hopeless?

    Cannot reinstate catalog after returning PC (Windows 7) to factory settings (because of worm infection). Catalog was backed up on external drive but not using PSE backup facility. Cannot find and *.tly file. Is this hopeless?

    If you made backups of all of your photos and your catalog file using some third-party method (i.e. not using the PSE catalog backup command), then you should be able to restore everything.
    Step 1. Put the photos in the EXACT SAME LOCATION as before. For example, if they were in subfolders of C:\Users\<username>\Documents, then they must go into the exact same subfolders of C:\Users\<username>\Documents.
    Step 2. Move the catalog file to wherever you want it to be, and then double-click on it.

  • How do I find and open saved documents?

    How do I find and open saved documents?

    After you convert documents from PDF to Word or Excel with the ExportPDF service, you can find the converted files in whatever folder you saved them to.  The default save location for files varies by browser.  I would suggest searching your hard drive for the file name either via the Windows SmartSearch or Mac Spotlight.
    Please let us know if you have any questions.
    -David

  • IN FINDER WHEN OPENING FILES  EACH AP IS X3

    IN FINDER WHEN OPENING FILES WHEN YOU RIGHT CLICK OPEN WITH OFFERS EACH AP X3 ,e.g, iTunes ,iTunes,iTunes, evernote, evernote evernote,
    vlc vlc vlc, and so on can any one help please.  thanks.     ps  i am on mavericks now.

    This can be easily fixed by rebuilding the Launch Services database. Instructions can be found e.g. here:
    http://www.tekrevue.com/tip/rebuild-launchservices-fix-duplicate-entries-os-xs-o pen-menu/

  • How do I find and open the CD folder on a 13" macbook pro??

    How do I find and open the Cd folder on a 13" macbook pro , so I can read the content on the cd with pages.

    If the CD is not showing on the desktop, go to Finder on the menu bar, Preferences, General and check the box for CDs, DVDs,and iPods.  Then double click the image of the CD on the desktop to open and display the contents of the CD.

  • Just bought my first mac and trying to find and open a usb thumb drive

    Just bought my first mac and trying to find and open a usb thumb drive. Simple procedure on my pc but lost on the mac book.

    Is it on your desktop? Finder>Preferences>General>> show external Disk
    double click the icon on desktop

  • Aborting index build. Too many errors with finding and copying files ...

    Hi dears,
    I'm using UCM 11g.
    I'm trying to start the automatic update cycle. When i start it, it gives me an error message just like :
    Indexing aborted at :<time>. Aborting index build. Too many errors with finding and copying files to the appropriate place.+
    Can anybody help me about this problem?
    Helps will be appreciated.
    Erdo
    Edited by: erdo on 28.Mar.2013 11:11

    Read this: error in Collection Rebuild Cycle
    and maybe also UCM Indexer - Collection Rebuild Cycle errorring out

Maybe you are looking for

  • Error in Single Row Object Type

    Hi Buddies, I have created 2 single row Object Type.It shows as Follows; SQL> create or replace type dob_date as object *2 (Day number,* *3 Month varchar2(12),* *4 year Number);* *5 /* Type created. SQL> create or replace type names as object *2 (Fna

  • Problems with snow leopard, labtop, desktop, and final cut 4.0.1

    Hello - I was in the apple store awhile ago to have my Mac OS X 10.6.5 worked on. They updated the operating system to snow leopard 10.6. When we got back we reinstalled Final Cut Express, which I have been using on my laptop Mac OS X 10.5.8. I use a

  • Open directory users cannot connect to iCal.

    Lion 10.7.5 server. I had to export users and groups, take it back to a stand alone server and then recreate the OD master and import groups and users and reenter passwords. Filesharing works and the Wiki server works (and can be logged into) but use

  • Cisco AP 1131AG - Problem with assign IP

    Hello I have a Cisco AP 1131Ag with ip 192.168.1.100 and mask 255.255.255.0 ANd two laptops with PCI WIRELESS a/g I have configurated a Ap with SSID : Ciscoap2010 , no security,no vlan 1.When a laptop detect new wireless,it show "other networks" but

  • Error trying to run rivendell

    Hi! I am trying to run rinvendell ( http://www.rivendellaudio.org/ ) but now I have this error: $ /usr/local/bin/rdadmin /usr/local/bin/rdadmin: error while loading shared libraries: librd-1.1.1.so: cannot open shared object file: No such file or dir