Re: anyone have a script to change : to - in file and dir names?


Subject: Re: anyone have a script to change : to - in file and dir names?
From: Danny Sauer (dsauer@teleologic.net)
Date: Wed Jun 13 2001 - 11:08:18 EDT


Chris wrote regarding 'anyone have a script to change : to - in file and dir names?' on Wed, Jun 13 at 09:59:
> hi,
>
> does anyone have a script which deals correctly with spaces etc in names,
> works on the linux/unix side and changes colons in file names to a hyphen?
> pesky things got there before i realized how useful the nohex option is.

for F in `find /path/to/files -name '*:*'`; do mv "$F" "`echo $F | sed 's/:/-/g'`"; done

I'm pretty sure that'll work if you're using a bourne shell (bash, for
example). Maybe put an echo in before the mv the first time you run
it, so you can see if the command being executed looks right... :) I
sure haven't tested it.

--Danny



This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:42 EDT