Avatar
Fernando Vásquez is an electronics engineer and software developer currently based in the world. He occasionally blogs about Python and Android programming.

Filename Rename

  • Filename rename
ls -d *.php3 | sed 's/\(.*\).php3$/mv "&" "\1.php"/' | sh
  • Using for:
for x in `ls -d *.php3 | sed 's/.php3$//'`; do mv $x.php3 $x.php; done
for i in `ls -d *.sql | sed 's/^izvjestajac_//'`; do mv izvjestajac_$i $i; done
  • Alternatives
mv `ls -l *.txt | cut -d ":" -f 2 | cut -d " " -f 2`
for f in *.txt; do mv "${f}" "${f/.txt/.nfo}"; done; 
for f in /export/home/data/cdrsSS/SS/*.viejo; do mv "${f}" "${f/.viejo/}"; done;

all tags