Avatar of toben88
toben88

asked on 

Exclude .log files from BASH script

I have a BASH script that works but I need to skip over the .log files.

Here is the script - how do I get the "for movie ..."  line to exclude all .log files in that directory?

#!/bin/bash
for movie in /home/smartdata/www/html/files/encode/flv/*.* ; do
    NEWNAME=`basename $movie`
    NEWNAME="${NEWNAME%%.*}.flv"
    NEWPATH=/home/smartdata/www/html/files/encoding/flv/$NEWNAME
    FINALPATH=/home/smartdata/www/html/files/encoded/flv/$NEWNAME
    mencoder "$movie" -o "$NEWPATH" -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=416:312 -srate 22050
    mv $movie /var/www/html/files/encode/flv/finished/
    mv $NEWPATH $FINALPATH
done
Shell Scripting

Avatar of undefined
Last Comment
Tintin
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ozo
ozo
Flag of United States of America image

[ "${movie%*.log}" ] || continue;
Avatar of Tintin
Tintin

or

for movie in `ls /home/smartdata/www/html/files/encode/flv/*.*|grep -v '.log'` ; do
Shell Scripting
Shell Scripting

The term 'shell' refers to a general class of text-based command interpreters most often associated with the UNIX and Linux operating systems. Popular shells include Bourne, Debian Almquist (dash), Korn (ksh), Bourne Again (bash) and the C shell family (csh). Some view the DOS 'cmd' prompt as a minimal shell of sorts. It is also possible to install Cygwin on Windows and emulate a full Unix environment with complete shell capabilities. Terminal emulators, such as xterm, GNOME Terminal and OS X Terminal, can be used to access shell.

11K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo