11
edits
No edit summary |
mNo edit summary |
||
| Line 8: | Line 8: | ||
In this scenario, we are going to try and rename all .php files in the current directory so they have a .gif extension | In this scenario, we are going to try and rename all .php files in the current directory so they have a .gif extension | ||
'''WARNING:''' always backup your files | |||
=== Using mmv === | === Using mmv === | ||
mmv '*.php' '#1.gif' | mmv '*.php' '#1.gif' | ||
=== Using rename === | === Using rename === | ||
rename 's/\.php$/.gif/' *.php | rename 's/\.php$/.gif/' *.php | ||
=== In the Bash shell === | === In the Bash shell === | ||
OLDIFS=$IFS; IFS="\n"; for file in *.php; do newfile=`echo $file | sed -e 's/\.php$/\.gif/'`; mv $file $newfile; done; IFS=$OLDIFS | OLDIFS=$IFS; IFS="\n"; for file in *.php; do newfile=`echo $file | sed -e 's/\.php$/\.gif/'`; mv $file $newfile; done; IFS=$OLDIFS | ||
edits