While it's easy to find video files, it's not easy to check wheter they are Movies or part of TV Series; this could be important if you need to move files before cataloguing them. Using Regex this could become possibile. Normally TV Series are names with Season and Episode numbers in the file name, this way: "X-Files S01E12 - Gna gna gna.avi" or "3x04.Falling.Skies.-.The.Revenge.mkv" and so on. This RegEx will find correct Episodes if they have the structure "S00E00" or "0E00" or "S00x00" or "0x00". In case you should need to find Movies but NOT TV Series, you have to inverse the RegEx when finding video files: find . -type f -regextype posix-extended ! -regex '^.*[S|s|\.| ]{0,1}[0-9]{1,2}[e|x][0-9][0-9].*\.(avi|mkv|srt)$' \( -iname "*.mkv" -or -iname "*.avi"-or -iname "*.srt" \)
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: