How can I find all video files on my system?











up vote
9
down vote

favorite
1












I tried using the Unity Lens File search for *.* and filtering by Last Modified=All, Type=Videos, and Size=All but found nothing although I know there are some .3gp files in my Pictures folder. I know that I have numerous video files on another drive mounted on the file system as well. I compiled a list of likely extensions and I tried numerous iterations of the find command utilizing these with find ./ -name "*.ext" -o (etc, etc, ad nauseum) with no luck whatsoever. What is the solution?










share|improve this question
























  • I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
    – Jo-Erlend Schinstad
    Nov 2 '16 at 16:37










  • @Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
    – Elder Geek
    Nov 2 '16 at 16:42










  • But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
    – Jo-Erlend Schinstad
    Nov 2 '16 at 20:09










  • @Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
    – Elder Geek
    Nov 2 '16 at 20:16










  • You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
    – Jo-Erlend Schinstad
    Nov 3 '16 at 11:30















up vote
9
down vote

favorite
1












I tried using the Unity Lens File search for *.* and filtering by Last Modified=All, Type=Videos, and Size=All but found nothing although I know there are some .3gp files in my Pictures folder. I know that I have numerous video files on another drive mounted on the file system as well. I compiled a list of likely extensions and I tried numerous iterations of the find command utilizing these with find ./ -name "*.ext" -o (etc, etc, ad nauseum) with no luck whatsoever. What is the solution?










share|improve this question
























  • I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
    – Jo-Erlend Schinstad
    Nov 2 '16 at 16:37










  • @Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
    – Elder Geek
    Nov 2 '16 at 16:42










  • But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
    – Jo-Erlend Schinstad
    Nov 2 '16 at 20:09










  • @Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
    – Elder Geek
    Nov 2 '16 at 20:16










  • You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
    – Jo-Erlend Schinstad
    Nov 3 '16 at 11:30













up vote
9
down vote

favorite
1









up vote
9
down vote

favorite
1






1





I tried using the Unity Lens File search for *.* and filtering by Last Modified=All, Type=Videos, and Size=All but found nothing although I know there are some .3gp files in my Pictures folder. I know that I have numerous video files on another drive mounted on the file system as well. I compiled a list of likely extensions and I tried numerous iterations of the find command utilizing these with find ./ -name "*.ext" -o (etc, etc, ad nauseum) with no luck whatsoever. What is the solution?










share|improve this question















I tried using the Unity Lens File search for *.* and filtering by Last Modified=All, Type=Videos, and Size=All but found nothing although I know there are some .3gp files in my Pictures folder. I know that I have numerous video files on another drive mounted on the file system as well. I compiled a list of likely extensions and I tried numerous iterations of the find command utilizing these with find ./ -name "*.ext" -o (etc, etc, ad nauseum) with no luck whatsoever. What is the solution?







bash video files find file-format






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 5 '17 at 16:40

























asked Nov 2 '16 at 15:21









Elder Geek

26.3k952124




26.3k952124












  • I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
    – Jo-Erlend Schinstad
    Nov 2 '16 at 16:37










  • @Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
    – Elder Geek
    Nov 2 '16 at 16:42










  • But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
    – Jo-Erlend Schinstad
    Nov 2 '16 at 20:09










  • @Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
    – Elder Geek
    Nov 2 '16 at 20:16










  • You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
    – Jo-Erlend Schinstad
    Nov 3 '16 at 11:30


















  • I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
    – Jo-Erlend Schinstad
    Nov 2 '16 at 16:37










  • @Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
    – Elder Geek
    Nov 2 '16 at 16:42










  • But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
    – Jo-Erlend Schinstad
    Nov 2 '16 at 20:09










  • @Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
    – Elder Geek
    Nov 2 '16 at 20:16










  • You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
    – Jo-Erlend Schinstad
    Nov 3 '16 at 11:30
















I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
– Jo-Erlend Schinstad
Nov 2 '16 at 16:37




I haven't tried it, but there was an article on OMG! Ubuntu about the FSearch app. You may want to check it out. omgubuntu.co.uk/2016/10/fsearch-fast-file-search-tool-linux
– Jo-Erlend Schinstad
Nov 2 '16 at 16:37












@Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
– Elder Geek
Nov 2 '16 at 16:42




@Jo-ErlendSchinstad Thank you for the suggestion but as I'm getting my results via the CLI in under 3 seconds, I'm satisfied with this approach. I will look at it though. :-)
– Elder Geek
Nov 2 '16 at 16:42












But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
– Jo-Erlend Schinstad
Nov 2 '16 at 20:09




But unless you understand the command, you're going to forget it. And if you did understand the commands, then you wouldn't have asked the question. Let's improve Ubuntu by making things easier for those who just want to get the job done. You can do that by adding apps or by pointing people to apps that are already there.
– Jo-Erlend Schinstad
Nov 2 '16 at 20:09












@Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
– Elder Geek
Nov 2 '16 at 20:16




@Jo-ErlendSchinstad I often begin lacking understanding which I obtain via research and analysis. I believe this approach is vital to development. The discovery process led me to a solution that I've chosen to share here as I've created a script and placed it in ~/bin I'm unlikely to forget and know where to look if I do. Since it's in my answer as well, anyone with the motivation can parse and understand it as well.
– Elder Geek
Nov 2 '16 at 20:16












You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
– Jo-Erlend Schinstad
Nov 3 '16 at 11:30




You're right. We don't actually need desktops. We can do nearly everything using command lines. But if we want to grow, we must realize that most people don't want to learn that kind of thing. I know developers who can't even describe the differences between the stack and the heap.
– Jo-Erlend Schinstad
Nov 3 '16 at 11:30










2 Answers
2






active

oldest

votes

















up vote
8
down vote



accepted










Alternative: search on file:



sudo find . -type f -exec file -N -i -- {} + | grep video


or if you only want the filenames ...



sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'




-N, --no-pad: Don't pad filenames



-i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).





The FILES section points to:




Files



/usr/share/misc/magic.mgc Default compiled list of magic.



/usr/share/misc/magic Directory containing default magic files.






file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.





Using locate:



locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v





share|improve this answer























  • Which "FILES section, below"
    – Elder Geek
    Nov 2 '16 at 15:42










  • added! it was hidden in the man page :D
    – Rinzwind
    Nov 2 '16 at 15:45










  • That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
    – Elder Geek
    Nov 2 '16 at 18:26










  • Oh... locate does all files. Your find is from where you are does it not?
    – Rinzwind
    Nov 2 '16 at 18:34












  • I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
    – Elder Geek
    Nov 2 '16 at 18:40




















up vote
3
down vote













I imagine this could be done as a 1-liner but it seemed a bit cumbersome so I created a script for ease of launching and editing and called it findvids.sh This is what worked for me.



Note: I may not have covered ALL the video file types, but I'm sure I have most of them. One notable exception is .mkv as that is the target format for the project and I don''t need to find the files that have already been processed. It should be very simple to add additional formats (extensions) to the script to suit your needs by examining the pattern and adjusting accordingly while maintaining the quotes at the beginning and end of the expression. Note that files you don't have permission to read will not be found.



#!/bin/bash
#This script is intended to find virtually all video file formats.
find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp*$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"


I did a speed comparison to using locate and the results were:



time locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v

real 0m8.887s
user 0m5.814s
sys 0m0.052s


vs.



time find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp4$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"

real 0m2.795s
user 0m0.657s
sys 0m1.115s


Unexpectedly find is faster. I'll be using this approach.



Edit: further testing indicates that locate was faster on a different machine. I think my initial speed test results were bunk due to caching.



Sources:



man find



man grep



https://stackoverflow.com/questions/7190565/unix-find-multiple-file-types






share|improve this answer























  • touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
    – Rinzwind
    Nov 2 '16 at 15:36










  • @Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
    – Elder Geek
    Nov 2 '16 at 15:40










  • Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
    – Rinzwind
    Nov 2 '16 at 15:42










  • @Rinzwind I'd love to see a working example of this using locate.
    – Elder Geek
    Nov 2 '16 at 16:18










  • added a locate.
    – Rinzwind
    Nov 2 '16 at 18:16











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f844711%2fhow-can-i-find-all-video-files-on-my-system%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
8
down vote



accepted










Alternative: search on file:



sudo find . -type f -exec file -N -i -- {} + | grep video


or if you only want the filenames ...



sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'




-N, --no-pad: Don't pad filenames



-i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).





The FILES section points to:




Files



/usr/share/misc/magic.mgc Default compiled list of magic.



/usr/share/misc/magic Directory containing default magic files.






file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.





Using locate:



locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v





share|improve this answer























  • Which "FILES section, below"
    – Elder Geek
    Nov 2 '16 at 15:42










  • added! it was hidden in the man page :D
    – Rinzwind
    Nov 2 '16 at 15:45










  • That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
    – Elder Geek
    Nov 2 '16 at 18:26










  • Oh... locate does all files. Your find is from where you are does it not?
    – Rinzwind
    Nov 2 '16 at 18:34












  • I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
    – Elder Geek
    Nov 2 '16 at 18:40

















up vote
8
down vote



accepted










Alternative: search on file:



sudo find . -type f -exec file -N -i -- {} + | grep video


or if you only want the filenames ...



sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'




-N, --no-pad: Don't pad filenames



-i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).





The FILES section points to:




Files



/usr/share/misc/magic.mgc Default compiled list of magic.



/usr/share/misc/magic Directory containing default magic files.






file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.





Using locate:



locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v





share|improve this answer























  • Which "FILES section, below"
    – Elder Geek
    Nov 2 '16 at 15:42










  • added! it was hidden in the man page :D
    – Rinzwind
    Nov 2 '16 at 15:45










  • That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
    – Elder Geek
    Nov 2 '16 at 18:26










  • Oh... locate does all files. Your find is from where you are does it not?
    – Rinzwind
    Nov 2 '16 at 18:34












  • I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
    – Elder Geek
    Nov 2 '16 at 18:40















up vote
8
down vote



accepted







up vote
8
down vote



accepted






Alternative: search on file:



sudo find . -type f -exec file -N -i -- {} + | grep video


or if you only want the filenames ...



sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'




-N, --no-pad: Don't pad filenames



-i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).





The FILES section points to:




Files



/usr/share/misc/magic.mgc Default compiled list of magic.



/usr/share/misc/magic Directory containing default magic files.






file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.





Using locate:



locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v





share|improve this answer














Alternative: search on file:



sudo find . -type f -exec file -N -i -- {} + | grep video


or if you only want the filenames ...



sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'




-N, --no-pad: Don't pad filenames



-i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).





The FILES section points to:




Files



/usr/share/misc/magic.mgc Default compiled list of magic.



/usr/share/misc/magic Directory containing default magic files.






file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.





Using locate:



locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 2 '16 at 18:15

























answered Nov 2 '16 at 15:33









Rinzwind

203k27388522




203k27388522












  • Which "FILES section, below"
    – Elder Geek
    Nov 2 '16 at 15:42










  • added! it was hidden in the man page :D
    – Rinzwind
    Nov 2 '16 at 15:45










  • That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
    – Elder Geek
    Nov 2 '16 at 18:26










  • Oh... locate does all files. Your find is from where you are does it not?
    – Rinzwind
    Nov 2 '16 at 18:34












  • I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
    – Elder Geek
    Nov 2 '16 at 18:40




















  • Which "FILES section, below"
    – Elder Geek
    Nov 2 '16 at 15:42










  • added! it was hidden in the man page :D
    – Rinzwind
    Nov 2 '16 at 15:45










  • That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
    – Elder Geek
    Nov 2 '16 at 18:26










  • Oh... locate does all files. Your find is from where you are does it not?
    – Rinzwind
    Nov 2 '16 at 18:34












  • I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
    – Elder Geek
    Nov 2 '16 at 18:40


















Which "FILES section, below"
– Elder Geek
Nov 2 '16 at 15:42




Which "FILES section, below"
– Elder Geek
Nov 2 '16 at 15:42












added! it was hidden in the man page :D
– Rinzwind
Nov 2 '16 at 15:45




added! it was hidden in the man page :D
– Rinzwind
Nov 2 '16 at 15:45












That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
– Elder Geek
Nov 2 '16 at 18:26




That's odd, I would have expected locate to be faster, but with your locate command I get time:real 0m8.985s and with my find command I get time:real 0m2.595s
– Elder Geek
Nov 2 '16 at 18:26












Oh... locate does all files. Your find is from where you are does it not?
– Rinzwind
Nov 2 '16 at 18:34






Oh... locate does all files. Your find is from where you are does it not?
– Rinzwind
Nov 2 '16 at 18:34














I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
– Elder Geek
Nov 2 '16 at 18:40






I did add the -e switch which didn't have much impact but returning results for files that are already gone didn't seem helpful. granted sys time is much lower for locate but real time to results is all I really care about.
– Elder Geek
Nov 2 '16 at 18:40














up vote
3
down vote













I imagine this could be done as a 1-liner but it seemed a bit cumbersome so I created a script for ease of launching and editing and called it findvids.sh This is what worked for me.



Note: I may not have covered ALL the video file types, but I'm sure I have most of them. One notable exception is .mkv as that is the target format for the project and I don''t need to find the files that have already been processed. It should be very simple to add additional formats (extensions) to the script to suit your needs by examining the pattern and adjusting accordingly while maintaining the quotes at the beginning and end of the expression. Note that files you don't have permission to read will not be found.



#!/bin/bash
#This script is intended to find virtually all video file formats.
find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp*$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"


I did a speed comparison to using locate and the results were:



time locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v

real 0m8.887s
user 0m5.814s
sys 0m0.052s


vs.



time find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp4$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"

real 0m2.795s
user 0m0.657s
sys 0m1.115s


Unexpectedly find is faster. I'll be using this approach.



Edit: further testing indicates that locate was faster on a different machine. I think my initial speed test results were bunk due to caching.



Sources:



man find



man grep



https://stackoverflow.com/questions/7190565/unix-find-multiple-file-types






share|improve this answer























  • touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
    – Rinzwind
    Nov 2 '16 at 15:36










  • @Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
    – Elder Geek
    Nov 2 '16 at 15:40










  • Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
    – Rinzwind
    Nov 2 '16 at 15:42










  • @Rinzwind I'd love to see a working example of this using locate.
    – Elder Geek
    Nov 2 '16 at 16:18










  • added a locate.
    – Rinzwind
    Nov 2 '16 at 18:16















up vote
3
down vote













I imagine this could be done as a 1-liner but it seemed a bit cumbersome so I created a script for ease of launching and editing and called it findvids.sh This is what worked for me.



Note: I may not have covered ALL the video file types, but I'm sure I have most of them. One notable exception is .mkv as that is the target format for the project and I don''t need to find the files that have already been processed. It should be very simple to add additional formats (extensions) to the script to suit your needs by examining the pattern and adjusting accordingly while maintaining the quotes at the beginning and end of the expression. Note that files you don't have permission to read will not be found.



#!/bin/bash
#This script is intended to find virtually all video file formats.
find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp*$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"


I did a speed comparison to using locate and the results were:



time locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v

real 0m8.887s
user 0m5.814s
sys 0m0.052s


vs.



time find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp4$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"

real 0m2.795s
user 0m0.657s
sys 0m1.115s


Unexpectedly find is faster. I'll be using this approach.



Edit: further testing indicates that locate was faster on a different machine. I think my initial speed test results were bunk due to caching.



Sources:



man find



man grep



https://stackoverflow.com/questions/7190565/unix-find-multiple-file-types






share|improve this answer























  • touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
    – Rinzwind
    Nov 2 '16 at 15:36










  • @Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
    – Elder Geek
    Nov 2 '16 at 15:40










  • Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
    – Rinzwind
    Nov 2 '16 at 15:42










  • @Rinzwind I'd love to see a working example of this using locate.
    – Elder Geek
    Nov 2 '16 at 16:18










  • added a locate.
    – Rinzwind
    Nov 2 '16 at 18:16













up vote
3
down vote










up vote
3
down vote









I imagine this could be done as a 1-liner but it seemed a bit cumbersome so I created a script for ease of launching and editing and called it findvids.sh This is what worked for me.



Note: I may not have covered ALL the video file types, but I'm sure I have most of them. One notable exception is .mkv as that is the target format for the project and I don''t need to find the files that have already been processed. It should be very simple to add additional formats (extensions) to the script to suit your needs by examining the pattern and adjusting accordingly while maintaining the quotes at the beginning and end of the expression. Note that files you don't have permission to read will not be found.



#!/bin/bash
#This script is intended to find virtually all video file formats.
find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp*$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"


I did a speed comparison to using locate and the results were:



time locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v

real 0m8.887s
user 0m5.814s
sys 0m0.052s


vs.



time find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp4$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"

real 0m2.795s
user 0m0.657s
sys 0m1.115s


Unexpectedly find is faster. I'll be using this approach.



Edit: further testing indicates that locate was faster on a different machine. I think my initial speed test results were bunk due to caching.



Sources:



man find



man grep



https://stackoverflow.com/questions/7190565/unix-find-multiple-file-types






share|improve this answer














I imagine this could be done as a 1-liner but it seemed a bit cumbersome so I created a script for ease of launching and editing and called it findvids.sh This is what worked for me.



Note: I may not have covered ALL the video file types, but I'm sure I have most of them. One notable exception is .mkv as that is the target format for the project and I don''t need to find the files that have already been processed. It should be very simple to add additional formats (extensions) to the script to suit your needs by examining the pattern and adjusting accordingly while maintaining the quotes at the beginning and end of the expression. Note that files you don't have permission to read will not be found.



#!/bin/bash
#This script is intended to find virtually all video file formats.
find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp*$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"


I did a speed comparison to using locate and the results were:



time locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v

real 0m8.887s
user 0m5.814s
sys 0m0.052s


vs.



time find /. -type f | grep -E ".webm$|.flv$|.vob$|.ogg$|.ogv$|.drc$|.gifv$|.mng$|.avi$|.mov$|.qt$|.wmv$|.yuv$|.rm$|.rmvb$|/.asf$|.amv$|.mp4$|.m4v$|.mp4$|.m?v$|.svi$|.3gp$|.flv$|.f4v$"

real 0m2.795s
user 0m0.657s
sys 0m1.115s


Unexpectedly find is faster. I'll be using this approach.



Edit: further testing indicates that locate was faster on a different machine. I think my initial speed test results were bunk due to caching.



Sources:



man find



man grep



https://stackoverflow.com/questions/7190565/unix-find-multiple-file-types







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 11 at 22:48

























answered Nov 2 '16 at 15:21









Elder Geek

26.3k952124




26.3k952124












  • touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
    – Rinzwind
    Nov 2 '16 at 15:36










  • @Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
    – Elder Geek
    Nov 2 '16 at 15:40










  • Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
    – Rinzwind
    Nov 2 '16 at 15:42










  • @Rinzwind I'd love to see a working example of this using locate.
    – Elder Geek
    Nov 2 '16 at 16:18










  • added a locate.
    – Rinzwind
    Nov 2 '16 at 18:16


















  • touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
    – Rinzwind
    Nov 2 '16 at 15:36










  • @Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
    – Elder Geek
    Nov 2 '16 at 15:40










  • Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
    – Rinzwind
    Nov 2 '16 at 15:42










  • @Rinzwind I'd love to see a working example of this using locate.
    – Elder Geek
    Nov 2 '16 at 16:18










  • added a locate.
    – Rinzwind
    Nov 2 '16 at 18:16
















touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
– Rinzwind
Nov 2 '16 at 15:36




touch hello.mp4 does not create a video file >:-D and you might want to change it to locate to speed it up.
– Rinzwind
Nov 2 '16 at 15:36












@Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
– Elder Geek
Nov 2 '16 at 15:40




@Rinzwind Valid point regarding touch However since that hasn't been done on this system, it's not really relevant in this case. As far as locate is concerned I'd then have to run updatedb prior to in order to have current data would I not?
– Elder Geek
Nov 2 '16 at 15:40












Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
– Rinzwind
Nov 2 '16 at 15:42




Yes, updatedb is done every day so if you could assume you don't need to last few hours (the speed it returns the results is a magnitude higher than with find :D )
– Rinzwind
Nov 2 '16 at 15:42












@Rinzwind I'd love to see a working example of this using locate.
– Elder Geek
Nov 2 '16 at 16:18




@Rinzwind I'd love to see a working example of this using locate.
– Elder Geek
Nov 2 '16 at 16:18












added a locate.
– Rinzwind
Nov 2 '16 at 18:16




added a locate.
– Rinzwind
Nov 2 '16 at 18:16


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f844711%2fhow-can-i-find-all-video-files-on-my-system%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

數位音樂下載

When can things happen in Etherscan, such as the picture below?

格利澤436b