find all flash video by searching mimetype=x-flv

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

find all flash video by searching mimetype=x-flv

Post by grimdestripador »

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/
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

Re: find all flash video by searching mimetype=x-flv

Post by grimdestripador »

##And for your one liner command heroes

Code: Select all

find `locate Cache | grep mozilla | grep -v Cache/ | grep /Cache` -type f -exec mimetype {} \; | grep x-flv | sed 's#: video/##g' | sed s/x-flv//g | xargs -I {} cp -v {} ~/Downloads/
rich_roast

Re: find all flash video by searching mimetype=x-flv

Post by rich_roast »

I'm fond of:

Code: Select all

#Hint, I capitalize functions as one would a proper noun. As in "Hello! I'm Mr. Proper Noun, meet my friend Mrs. Proproper Function"
Proproper is epic.
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

Re: find all flash video by searching mimetype=x-flv

Post by grimdestripador »

This makes my day. Someone actually read the comments burried in a descriptive comment. I also meant to type Mrs. Proper, but somehow i typoed Mrs. Proper to be Mrs. Proproper. And friend is an odd relationship for someone who has the same last name. Perhaps it should have been wife or sister.
Locked

Return to “Scripts & Bash”