Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cutter74

macrumors member
Original poster
Nov 15, 2012
77
10
I'm trying to create an automator workflow that will continuously monitor my "Downloads" folder and upon detection of a certain file type extension (.pdf), will move that file to subfolder "Adobe".

I create and customise the workflow with the "Filter Finder Items" and "Move Finder Items" actions, but I am missing the AppleScript code that will wait until the file has completed downloading in order for Automator to use it in the correct destination folder.

Can someone please help me with the AppleScript code and also let me know if it's necessary for the Automator Workflow to be saved inside the "Downloads" folder or can be saved anywhere I want?

Thanks for your time.
 
I’m not at my Mac, so these steps might not be exactly right. Right click on your Downloads folder and choose “Folder Actions”. When you enable folder actions, it does exactly what you want. The system monitors specific folders and when it sees a triggering event, like the appearance of a pdf file, it will run an AppleScript of your choosing. Search Mac help for Folder Actions for more information. The web is also full of help if you search for it.
 
I've already done enabled the folder actions and tied the workflow to the Downloads folder. I have also searched the web and tried the following code but it won't work.

on run {input, parameters}

if input is {} then

return {}

end if



repeat

delay 1

set {size:fileSize, busy status:Busy} to (info for (input as alias))

if not Busy and (fileSize is greater than 0) then return input

end repeat

end run
 
I think you’re making it too hard. Folder Actions will monitor the download folder for you. Use the Automator app to move the file. It is super easy.

Screen_Shot_2018-04-01_at_1.19.59_PM.png
 
Last edited:
chabig, thank you but I already have these parts.

What I am trying to explain is that I need some sort of code or action that will instruct Automator to wait until the file has completed downloading. This code should go in between of the two actions you mention, otherwise Automator unfortunately grabs the file before it completes downloading, and the file never gets to the target directory.
 
That first filter should capture the pdf after it’s done downloading. It’s not a pdf until the download is complete.

I’ll try it on my Mac later.
 
Turns out, if I change the first filter from File Extension "is" to File Extension "contains", the two actions are enough by themselves! Thx for your help, chabig
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.