Automator — apply workflow to multiple folders?

Discussion in 'Mac Apps and Mac App Store' started by mrzeigler, Mar 11, 2015.

  1. mrzeigler macrumors regular

    Joined:
    Oct 15, 2005
    Location:
    Pittsburgh
    #1
    I have several years of PDF archives of a weekly publication. For each page of each publication, there is a single PDF ... so if it was a 44-page publication that week, there are 44 single-page PDFs. I want to combine all those PDFs to create a single multi-page PDF per edition.

    I do NOT need help with that actual process — the first item listed in this Macworld article will do that nicely — but since I'm tackling several years of archives, I would like some help in tweaking that Automator workflow to so that I don't have to run it 52 times for each year of archives.

    The archives are set up like this, with 52 folders inside each year:

    Weekly archives
    • 2010
    • 2011
    • 2012
    • 2013
    • 2014

    I would be fine with have all of the combined PDFs being placed in a folder on my desktop. It would be easy enough for me to subsequently rename them via Automator and sort them into folders by year.

    I tried simply dragging the "Weekly archives" folder onto the Automator application as described in the Macworld article, but now the automator icon in my menu bar is spinning like mad ... I suspect my computer is trying to combine several thousand single-page PDFs into a single several-thousand-page long PDF.

    Any advice on how to alter that workflow so that it processes each weekly folder as a single PDF all in one batch?
     
  2. mrzeigler thread starter macrumors regular

    Joined:
    Oct 15, 2005
    Location:
    Pittsburgh
    #3
    I tried the following workflow configuration, and all that's appearing in the destination folder are single-page PDFs (with different names from the original file) from the first weekly folder. I had dragged an entire year's directory onto the Automator app icon I'd created.

    Any suggestions on where I went astray?

    • Get Specified Finder Items
    • Get Folder Contents (repeat for each subfolder found)
    • Dispense Items Incrementally
    • Get Folder Contents
    • Combine PDF Pages
    • Move Finder Items (to specified desktop folder)
    • Loop (automatically ... stop after 52 times)
     
  3. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    Run your workflow manually from Automator. Look at the result of each action if it's the right kind of folders/files to pass on to the next action in the workflow.
    Start simple and make sure everything works as you intended before adding a loop and making an app.
     
  4. mns579 macrumors member

    Joined:
    Feb 28, 2015
    #5
    You have an unneeded step. This should do:

    Get Specified Finder Items
    Dispense Items Incrementally
    Get Folder Contents
    Combine PDF Pages
    Move Finder Items
    Loop
     
  5. mns579 macrumors member

    Joined:
    Feb 28, 2015
    #6
    Thinking a bit more about this procedure . . . .

    So, you have annual folders, each with 52 subfolders of PDFs? If so, you can use the workflow I've given above, but rather than target the annual folders (2010, 2011, etc.) in Get Specified Items, target their 52 weekly subfolders. You'll have to run the workflow once for each year of PDFs, but that process I imagine will be quicker than some alternatives.
     
  6. mns579 macrumors member

    Joined:
    Feb 28, 2015
    #7
    Eureka moment! You need two linked workflows so that you can Dispense twice.

    You'll have to experiment with the length of the Pause action in the Main workflow. I started with 5 seconds, but when I noticed that some files were remaining in /private/var/folders rather than getting moved to the Desktop, I increased the Pause to 15 seconds. That worked, though I was working with a relatively small sample: 3 annual folders, each with 2-4 weekly folders, and each of those weekly folders with PDFs of 1-15 pages. If you're dealing with thousands of pages, you may need to set the Pause to several (5-15?) minutes. Automator is not known for its speed.
     

    Attached Files:

Share This Page