find all flash video by searching mimetype=x-flv
Posted: Wed Aug 03, 2011 1:25 am
Code: Select all
#!/bin/sh
echo Copyright: grimdestripador 2011 under Linux Mint forums agreement
echo This will find all flash video by searching mimetype=x-flv
date ; echo The following is where you cache is:
export cachePlace=`locate Cache | grep mozilla | grep -v Cache/ | grep /Cache`; echo $cachePlace
#Hint, I capitalize functions as one would a proper noun. As in "Hello! I'm Mr. Proper Noun, meet my friend Mrs. Proproper Function"
echo "Please have patience while your mozilla cache is searched. ETA > 1 Minute. During this time, you may read an explanation of its execution. \n This is an exercise in the use of piping. The program Find is used at the cache folder to execute Mimetype. Mime type then prints into the stream bufer its textual output with filename and mimetype. Lines not containing x-flv are removed using Grep. The rest of the stream is continued to be piped through Sed. Sed continues removing chunks of text evolving into a simple list of return-separated filenames. The current stream of filenames is piped into Xargs which repetitively executes Cp on each of the filenames."
date
find $cachePlace -type f -exec mimetype {} \; | grep x-flv | sed 's#: video/##g' | sed s/x-flv//g | xargs -I {} cp -v {} ~/Downloads/