Archive for the ‘Bash’ Category

Portable shell scripting

26 September 2010 1 comment

Rename multiple files in Bash

8 November 2009 Leave a comment

Here’s a quick tip for renaming multiple files with the same name <name> but different extensions <ext>. You want to retain the extensions and only change <name> to <new-name>.

for i in `ls`; do
    mv -fv "$i" `ls "$i" | sed 's/././'`