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

Nor*Cal

macrumors regular
Original poster
Jun 17, 2007
156
0
Irvine, CA
So I have a folder action which looks like the following:

aYEBxip.png


It begins when a file is dropped into test folder, and ends when the file is moved to test folder 2.

However, I have another set of actions that I would like to run after the file is moved. It seems that after the last step, it is impossible to have another set of actions to occur in the original test folder. As a result I have had to create another folder action (on the same test folder) with a delay of 30 seconds or so (to allow the first folder action to complete). Is there action that I can put after the folder move to "start fresh" and allow for a new set of actions?
 
Describe exactly the workflow/actions you want to do when a file is dropped into test folder and the other set of actions you would like to run after the file is moved. There's no need for the Get Folder Contents and Get Selected Finder Items actions in a Folder Action. You can also create AppleScript-based folder actions.
 
Last edited:
Describe exactly the workflow/actions you want to do when a file is dropped into test folder and the other set of actions you would like to run after the file is moved. There's no need for the Get Folder Contents and Get Selected Finder Items actions in a Folder Action. You can also create AppleScript-based folder actions.

Thanks for the reply, this is what is happening in detail...

Action 1 (Runs on receiving file in folder 1)

  1. Get Folder Contents
  2. Get Selected Finder Items
  3. Filter Finder Items (kind is movie)
  4. Get Selected Finder Items
  5. Move Finder Items (to Folder 2)

Action 2 (Runs on receiving file in folder 1, currently has a pause as to not overlap with action 1)

  1. Pause (for 10 seconds)
  2. Filter Finder Items (find empty folders)
  3. Get Selected Items
  4. Move Items to Trash
 
What is the second workflow supposed to be moving to the trash?

As previously mentioned, you do not need the Get Folder Contents or Get Selected Finder Items actions, since items added to the attached folder are automatically passed to the folder action workflow. Your usage of the Get Selected Finder Items action would seem to indicate that you have the wrong idea about what Automator actions do. In an Automator workflow, the result of any given action is passed on to the input of the following action - you can see what an action outputs and expects for input in its description.
 
What is the second workflow supposed to be moving to the trash?

As previously mentioned, you do not need the Get Folder Contents or Get Selected Finder Items actions, since items added to the attached folder are automatically passed to the folder action workflow. Your usage of the Get Selected Finder Items action would seem to indicate that you have the wrong idea about what Automator actions do. In an Automator workflow, the result of any given action is passed on to the input of the following action - you can see what an action outputs and expects for input in its description.

The second workflow will move the empty folders it finds to the trash (after the movie file within it is moved, from action 1).

I know that it is not necessary to have some of the steps in there, but they worked and so I left them, I can remove them. I just don't know if it's possible to combine the two existing actions.
 
Well, the main problem I see is that if the folder the movie is in is the one that has the folder action attached to it, removing the folder will remove the folder action. Are you adding a folder (or folders) containing other files and folders? If so, you need to step back and describe exactly what you are wanting to do with all of the items dropped onto the folder, including those that are not moved.

The Get Selected Finder Items action will do just what its name says, and should really be removed to prevent unexpected results, since the action will add any selected Finder items to the folder action items.
 
Well, the main problem I see is that if the folder the movie is in is the one that has the folder action attached to it, removing the folder will remove the folder action. Are you adding a folder (or folders) containing other files and folders? If so, you need to step back and describe exactly what you are wanting to do with all of the items dropped onto the folder, including those that are not moved.

The Get Selected Finder Items action will do just what its name says, and should really be removed to prevent unexpected results, since the action will add any selected Finder items to the folder action items.

I'm only trying to move the folders within.

Essentially I'm trying to do the following:

  1. Extract all file types that are movie
  2. Move the movie files to another folder
  3. Delete all other files that are not movies or folders that do not contain movie files after steps 1 and 2 are complete.
 
That kind of workflow can be done by using variables. For example, the following workflow filters out movie files and copies those to another folder, then moves everything to the trash. I'm using the copy action because it is easier to just make copies than try to split things up into different lists, but you can use more variables to store different filtered lists if desired. The copy action is supposed to wait for the copy to complete, but I don't have a lot of large files around to test with, so you might want to keep an eye on it while testing:

1) Folder action receives files and folders added to { your attached folder }
2) Get Folder Contents { Repeat for each subfolder found } -- expand any contained items
3) Set Value of Variable { Variable: Original Items} -- save for later
4) Filter Finder Items { Kind is Movie } -- filter out those items to move...
5) Copy Finder Items { To: your destination folder } -- ...and move them
6) Get Value of Variable { Variable: Original Items } (Ignore Input) -- get the original list back
7) Move Finder Items to Trash

Note that the Ignore Input option is used on the Get Value of Variable action in step 6 - this is to prevent the paths of the previously copied items (which are returned from the copy action) from getting mixed in with the original list that is about to get trashed.
 
That kind of workflow can be done by using variables. For example, the following workflow filters out movie files and copies those to another folder, then moves everything to the trash. I'm using the copy action because it is easier to just make copies than try to split things up into different lists, but you can use more variables to store different filtered lists if desired. The copy action is supposed to wait for the copy to complete, but I don't have a lot of large files around to test with, so you might want to keep an eye on it while testing:

1) Folder action receives files and folders added to { your attached folder }
2) Get Folder Contents { Repeat for each subfolder found } -- expand any contained items
3) Set Value of Variable { Variable: Original Items} -- save for later
4) Filter Finder Items { Kind is Movie } -- filter out those items to move...
5) Copy Finder Items { To: your destination folder } -- ...and move them
6) Get Value of Variable { Variable: Original Items } (Ignore Input) -- get the original list back
7) Move Finder Items to Trash

Note that the Ignore Input option is used on the Get Value of Variable action in step 6 - this is to prevent the paths of the previously copied items (which are returned from the copy action) from getting mixed in with the original list that is about to get trashed.
Thank you for the help! However after testing these are my results:
  1. Dropping individual movie file by itself into Folder 1 — Works
  2. Dropping movie file within another folder into Folder 1 — Works, but doesn't delete original folder
 
Try swapping steps 2 and 3, so that the Original Items variable is set to the input items before getting any folder contents.

That did the trick!

One last thing, I decided to simplify things even more, and add my shell script which does the following:
  1. Uses ffmpeg to convert the extracted movie file to mp4
  2. Moves the movie file to another folder
  3. Trashes the original movie file

AeTyDXY.png


The bash script and action work correctly, however for some reason whenever the dropped filetype is mp4, the empty folder is not deleted. When I drop a mkv, or a movie without a parent folder, everything runs smoothly. Any ideas? For the most part it's working as expected, thank you very much!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.