PDA

View Full Version : [live] use file command to determine type of file


schneidz
2009-06-30, 01:38
hi when i browse videos i notice some files like tps-report.doc.avi show up in the list (without a thumbnail because it is a misnamed word document) and office-space.avi.swingline wont show up in the list because of the unusual extension.

maybe a few lines of bash code like the following will find files that truly are media files.

# find /media/hyper -exec find-vids.ksh '{}' \; > ~/moo-vees.tmp
# cat find-vids.ksh
#!/bin/bash

vid=`file $1 | awk -F : '{print $2}' | egrep "(AVI|ASF|MPEG)"`

if [ "$vid" ]
then
echo $1
fi