Remove prefix from filenames
25 January 2014
Assume you have some files with the same prefix, e.g. “old_” and want to rename them by stripping out the prefix.
In a bash shell here’s the code to write down ($==prompt)
$ for files in `ls old_*`
> do
> newfilename=`echo $files | cut -c5-`
> mv $files $newfilename
> done
blog comments powered by Disqus