#!/bin/bash EXT=js DIST=ts for name in `ls *.${EXT}`; do mv $name ${name%.${EXT}}.${DIST} done