euglug.org

[Eug-lug] Subject: Copying, moving, whatever… using wildcards in destination : wc2fn.py

작성자

카테고리:



Bob MillerTue Nov 2 08:12:27 PST 2004

horst wrote:

> Let's say I want to make my digital images all lowercase:
>     	mv *.JPJ *.jpg

	/usr/bin/rename .JPG .jpg *.JPG

> Let's assume a slightly more complicated example, like renaming
> files *BAR*FOO9[0-9].HTM from the 1990s to *bare*foot_199[0-9].html
> .

	/usr/bin/rename BAR bare *BAR*FOO9[0-9].HTM
	/usr/bin/rename FOO9 foot_199 *bare*FOO9[0-9].HTM
	/usr/bin/rename .HTM .html *bare*foot_199[0-9].HTM

(In real life, you'd use a simpler pattern for the third argument.
But I was matching precisely what you asked for.)

/usr/bin/rename is a GNU utility.  On my Gentoo box, it's
part of the sys-apps/util-linux package.

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     kbob at jogger-egg.com