Automator service to extract file and delete parent

automatorbashfilesystemfinder

I am trying to create an automator service to take the selected folders in Finder and search each of them for movie files, move those movie files to a certain directory and then move the original folder to trash. However I have no experience and keep getting stuck!

Up the top of the automator window I have selected this:

my service so far

I then thought the best thing to do would be to use the "Get Folder Contents" action and run some sort of bash script on each file.

But what would I put in the script? I don't know how to write bash scripts. I was thinking something along the lines of:

for each directory
for each file in the directory
if the file is a movie
move the file to this directory "path"
move the parent directory to trash

I don't know if I should select "Pass input as arguments" or "as stdin". Either way I don't know how to work with them.

Can anyone give me a bit of help with this script?

Cheers!

Best Answer