Created
June 4, 2011 17:15
-
-
Save lyrixx/1008082 to your computer and use it in GitHub Desktop.
Get a sorted list of your movies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VIDEO_FOLDER=( | |
/PATH/TO/MOVIE1 | |
/PATH/TO/MOVIE2 | |
) | |
VIDEO_EXTENTION=(avi mkv mpg mpeg) | |
OUTPUT='movie_list.txt' | |
OUTPUT_TEMP=${OUTPUT}.temp | |
`>$OUTPUT_TEMP` | |
for folder in "${VIDEO_FOLDER[@]}" | |
do | |
if [ -d $folder ]; then | |
for ext in "${VIDEO_EXTENTION[@]}" | |
do | |
find $folder -iname "*.$ext" >> $OUTPUT_TEMP | |
done | |
fi | |
done | |
`cat $OUTPUT_TEMP | awk -F "/" '{print $NF;}' | sort | uniq > $OUTPUT` | |
`rm $OUTPUT_TEMP` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment