On 08/15/2012 06:19 PM, Craig White wrote:
the relevant snippet is...
NAME="*.mov" cd $IN if test -n "$(find . -maxdepth 1 -name $NAME -print -quit)"
and if there is one file in this directory - ie test.mov, this works fine
but if there are two (or more) files in this directory - test.mov, test2.mov
then I get an error... find: paths must precede expression
So my code is evidently wrong. I just want a test for 1 or more files ending in .mov in the directory?
Any one want to toss me a bone here?
Are you trying to find out if there are one or more files that match, or are you trying to list the name(s) of the files?
NAME=`ls *.mov`
for FILE in $NAME do echo "$FILE" done