Change -- to . for all files in a directory

Posted by Larry on Stack Overflow See other posts from Stack Overflow or by Larry
Published on 2010-05-21T20:15:29Z Indexed on 2010/05/21 20:20 UTC
Read the original article Hit count: 172

Filed under:
|

Hello,

I need to rename all the files in a directory. Some examples of the source filenames are:

alpha--sometext.381928
comp--moretext.7294058

The resultant files would be renamed as:

alpha.sometext.381928
comp.moretext.7294058

The number of characters before and after the -- is not consistant.

The script needs to work on current installations of Ubuntu and FreeBSD. These are lean LAMP servers so only the necessary packages have been installed.

Thanks

© Stack Overflow or respective owner

Related posts about bash

Related posts about rename