rename files challenge...
June Tate
june at theonelab.com
Fri Aug 19 09:19:42 MST 2005
On Fri, Aug 19, 2005 at 09:17:11AM -0700, Craig White wrote:
> # find . -name "*%*.*"
>
> locates them, how do I pass them to a mv command to rename them without
> the '%' sign (I want to take the percent sign out of the filenames)?
>
> how about if I want to replace the % with an underscore?
Try something like this:
foo at bar:~$ for i in $(find . -name "*%*.*"); do \
> newname=$(echo $i |sed s/%/_/); \
> mv $i $newname; \
> done
This grabs the entire list of files and for each file in the list
generates a new filename by replacing the % with an _, and then mv-ing
it.
Hope that helps. =o)
--
June Tate * http://www.theonelab.com * june at theonelab.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.plug.phoenix.az.us/pipermail/plug-discuss/attachments/20050819/8b09c7cc/attachment.pgp
More information about the PLUG-discuss
mailing list