Automator - Move Video Files From One Folder To Another

Discussion in 'Mac Programming' started by Levi Alberta, Jan 29, 2014.

  1. Levi Alberta macrumors newbie

    Joined:
    Jan 29, 2014
    #1
    I'm attempting to use Automator on my Macbook Pro and Mac Mini (Mavericks) unsuccessfully.

    I have numerous files (videos) in one folder and I'm attempting to move specific files from one folder to another. I have been attempting to create folder actions so when a file is placed in the folder, it gets sorted immediately.

    The first folder action is attached.

    It was unsuccessful because it wouldn't find the items properly. For example, I had it searching for Family.Guy or Family Guy and it would move the appropriate files to a folder named "Family Guy". It would let through other items such as Arrow when clearly it is not even close to being the same. I found that it would work if I only had one folder action assigned. As soon as I had more then 1 I would begin experiencing the same problems.

    I then moved onto my next test which involved filtering. It is attached as well.
    This version was successful as long as I didn't have more then one. I made 4 folder actions with different sorting features (Trophy.Wife, Hawaii.Five, Justified, Family.Guy) however only the first one would actually work. After the first folder action completed (in this case it was Family.Guy) it would not move onto the next folder action. I tried combining all of the folder actions into one using the same methods as shown in the picture but it still wouldn't move onto the next item.

    What am I doing wrong? I figured this would be very simple but for some reason I can't get it to work.

    You may notice that sometimes I'm searching for Family.Guy or Family Guy. That is because the file name is not always the same. Some have periods, some do not.
     

    Attached Files:

  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Here's a Folder Action Script you can use. Don't forget to make the necessary changes. Open Applescript Editor and copy and paste the code into the window then save it. Copy the script to the Library==>Scripts==>Folder Action Scripts folder. In Finder right click the folder you want the script to attach to and from Services choose Folder Actions Setup. Select your script and click attach.

    Code:
    on adding folder items to this_folder after receiving these_items
    	(*
    	Variables for the various destinations. You need to change them to where you want to move your files! ¬
    	In my case the result of the first line is "MavericksDP:Users:kryten:Documents:FolderActionResult:Family Guy" ¬
    	eg "nameofyourhd:Users:yourusername:folder:folder:folder"
    *)
    
    	set fgDest to (path to documents folder as text) & "FolderActionResult:Family Guy"
    	set hwDest to (path to documents folder as text) & "FolderActionResult:Hawaii Five"
    	set jDest to (path to documents folder as text) & "FolderActionResult:Justified"
    	set twDest to (path to documents folder as text) & "FolderActionResult:Trophy Wife"
    	
    	repeat with anItem in these_items
    		tell application "Finder"
    			if name of anItem contains "Family Guy" or name of anItem contains "Family.Guy" then
    				move anItem to fgDest
    			else if name of anItem contains "Hawaii Five" or name of anItem contains "Hawaii.Five" then
    				move anItem to hwDest
    			else if name of anItem contains "Justified" then
    				move anItem to jDest
    			else if name of anItem contains "Trophy Wife" or name of anItem contains "Trophy.Wife" then
    				move anItem to twDest
    			end if
    		end tell
    	end repeat
    end adding folder items to
    
     

    Attached Files:

  3. Levi Alberta thread starter macrumors newbie

    Joined:
    Jan 29, 2014
    #3
    Thank you for your response. Looks like it should work perfectly.

    Shortly after pulling out what little hair I had remaining (and making that post), I downloaded a trial version of Hazel. I tried the same thing with Hazel and it worked perfectly.

    Either way, free is better then spending money so I will be sure to give that script a shot.
     

Share This Page