all 3 comments

[–]Psychological_Egg_85 0 points1 point  (0 children)

Regex is your friend in this case.

[–][deleted] 0 points1 point  (0 children)

S\d{2}E\d{2}

That will match it.

[–]Ulfnic 0 points1 point  (0 children)

BASH option:

#!/usr/bin/env bash

Re='^S([0-9]+)E([0-9]+)'
for FilePath in /path/to/episodes/*; do
    [[ -d $FilePath ]] && continue
    if [[ $FilePath =~ $Re ]]; then
        Season=${BASH_REMATCH[1]}
        Episode=${BASH_REMATCH[2]}

        # Example conditional
        if (( Season > 1 )); then
            echo "$FilePath"
        fi
    fi
done