Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Script to fix filenames


On Thu, Oct 12, 2000 at 09:31:05PM +1100, Nick Croft wrote:
> I keep getting batches of jpegs without the .jpeg extension (or any other
> permutation).
> 
> What area of scripting should I look to in order to add the extension. Is
> sed able to work on filenames in a directory as it doeson words in a file?
> 
> I've got over 200 of these and there are more to come.

for a in `file * | grep JPEG | grep -v .jpg | awk -F ":" {'print $1'}` ; 
do mv $a $a.jpg ;
done

I'm not very good with awk, but I think you can get rid of the
greps and use one awk statement.


-- 
	chesty