find file type linux code example
Example 1: find file type linux script
#! /bin/sh
if [ -f "$1" ] && [ "`file -b --mime-type \"$1\"`" = "image/jpeg" ]; then
echo "Good type for the file (JPEG)"
fi
Example 2: how to get file type in linux
file <filename>
Example 3: linux find file
# syntax
# find *</path/to/dir> '(' *<Filter-1> *<and/or-operator> *<filter-2> ')'
# example
find . '(' -name "Test*.pm" -a ! -name 'Useless*' ')'
Example 4: linux find filetype
find . -iname "*.err"