[Linux-disciples] Troubles with 'rename'
Adam Rosi-Kessel
adam at rosi-kessel.org
Sat Apr 30 09:43:34 EDT 2005
On Sat, Apr 30, 2005 at 09:36:42AM -0400, Stephen R Laniel wrote:
> Imagine I have a hierarchy of directories and files, some of
> whose names contain spaces. I'd like to rename all of them,
> replacing spaces with underscores. This approach to doing so
> doesn't seem to work:
> Does anyone know how to fix this problem?
I use a little script called lr, which stands for 'lower recursive'. You
could take out the lowercase part if you want:
#!/bin/bash
rename "tr/A-Z /a-z_/" *
for x in *
do
if [ -d "$x" ]
then
pushd "$x"
lr
popd
fi
done
--
Adam Rosi-Kessel
http://adam.rosi-kessel.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050430/80a61d7c/attachment.pgp
More information about the Linux-disciples
mailing list