Match S01E03 to move...

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Match S01E03 to move... Wed Aug 14, 2013 8:31 am • by macmattias
Hey all!
Been struggling with a rule to move any tv-shows files in Downloads folder.

First I tried the Name match, did not work.
Oh well, went to the ground I know. Shell script.
Passes shell script:

Code: Select all
#!/bin/bash
if [[ "$1" =~ (S[0-9]{2}E[0-9]{2}$) ]]; then
                exit 0
else
                exit 1
fi


But this do not discover the tv-shows files.
Any help is appreciated. :)
macmattias
 
Posts: 9
Joined: Sat Feb 23, 2013 5:59 pm

Re: Match S01E03 to move... Wed Aug 14, 2013 11:27 am • by a_freyer
... matching is absolutely the way to do this. See a quick tutorial I wrote here.

Your rule will look like this:

Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
     name matches (...)S(• season number)E(• episode number) (...)

Do the following to the matched file or folder:
     …


It is likely that you forgot to include "anything" buffers on either side of the season or episode number matching. If you don't do this, you will not have the "entire" name match for Hazel.

Your shell script doesn't work likely because of the default shell for Hazel. More reliable to use binaries:


Code: Select all
if [[ "$(basename "$1" | grep -Eic "S[0-9]{2}E[0-9]{2}" )" == 1 ]]; then
...
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Match S01E03 to move... Thu Aug 15, 2013 1:26 am • by macmattias
Ahhh great! Thank you!

Now it is working. And Hazel just made my day so beautiful. :D
macmattias
 
Posts: 9
Joined: Sat Feb 23, 2013 5:59 pm


Return to Support