Rename extensions | filename in bulk
A mysterious virus , had changed the extensions of *.avi to *.jpeg , in on of friends portable harddisk , know the power of Linux , she asked can you write a small code to change the extensions , i gave it a try this way :
for i in *.jpg; do j=`echo $i | cut -d . -f 1`; j=$j".avi"; mv $i $j; done
Further tried to make it more generic
#!/bin/bash
old=$(zenity --entry --text="Current extension" --title="Rename")
new=$(zenity --entry --text="New extension or name" --title="Rename")
for i in *.$old; do j=`echo $i | cut -d . -f 1`; j=$j".$new"; mv $i $j; done
zenity --info --text="Done"
Steps in images :
Recent blog posts
- watir-webdriver web inspector
- gem list to gemfile
- Packing ruby2.0 on debian.
- Made it into The Guinness Book!
- to_h in ruby 2.0
- Filter elements by pattern jQuery.
- Better HTML password fields for mobile ?
- Grayscale image when user offline
- nth-child CSS pseudo-class Christmas colors
- EventEmitter in nodejs