Third party cookies may be stored when visiting this site. Please see the cookie information.

Rename files in Linux using the command line

Here are some short scripts that can be used to rename files in Linux.

These are examples that can be modified as required.

Change file extensions

Rename all files in a directory that end with .php5 to end with .php

for x in *.php5; do n=${x/.php5/.php}; mv $x $n; done

Add a prefix to a filename

for x in *.jpg; do mv $x prefix_$x; done

» PenguinTutor Facebook page