REXX equivalent in (Ubuntu) Linux?

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Fri May 21 18:04:39 UTC 2010


On Fri, May 21, 2010 at 10:17:03AM -0400, Stephen wrote:
> I want to do a big rename of files on my Linux system.
> 
> I have ripped a large number of CD's, and the filenames start with the 
> track number. But they go 1,2,3 ...10,11,12
> 
> When my PS3 accesses my (Linux) media server, it sees these as 
> 10,11,12,1,2....
> 
> So to get the right order I want to change the files to 01,02,03...
> 
> 
> The files are in directories:
> 
> /home/stephen/music/*artist*/*album*/filenames
> 
> What should I look at?
> 
> BASH???

Could you not do something like 'ls -v' ?

If not, then rename them like

    find /home/stephen/music/*artist*/*album*/filenames \
	-type f -name '[0-9][^0-9]*' -execdir mv '{}' '0{}' ';'

This will not catch single digit filename.  To catch those, do second
run.

-- 
William

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list