[buug] Unix script for replacing character in file or folder name?
Aaron T Porter
atporter at primate.net
Wed May 25 19:09:08 PDT 2005
On Wed, May 25, 2005 at 08:33:53PM -0500, Gary Mielke wrote:
> I was wondering if anybody has a unix shell script that would replace a
> specific character in a file or folder. I would like the script to look into
> one directory and search all the sub folders and files and if it finds a ":"
> colon character in any of the names that it would replace it with a "_"
> underscore. Has anybody worked with a similar script that they would be
> willing to share?
for dir in `find /path/to/check -type d -name '*:*'` ; do mv $dir `echo $dir | tr : _` ; done
More information about the buug