[NTLUG:Discuss] batch file rename

Rusty Haddock rusty at fe2o3.lonestar.org
Fri Sep 19 03:37:16 CDT 2014


Bobby Wrenn wrote:
    >I took out the extra "sed" and escaped the "+". No error but the script 
    >just executes and never exits. Nothing happens.
    >
    >No on line examples that I found addressed this kind of transposition in 
    >the file name. Any other ideas, anyone?

This worked for me for changing filesd like CCC-05-15-2014.mp3 to
20140515.mp3:

    for i in *.mp3
    do
	IFS="${IFS}-." set $i
	mv $i $4$2$3.mp3
    done

	-Rusty-
-- 
   _____                Rusty Haddock  <=>  AE5AE
|\/   o \   o             Way out yonder in the
|   (  -<  O o      Van Alstyne (TX) Metropolitan Area
|/\__V__/       Math illiteracy affects 7 out of 5 people!



More information about the Discuss mailing list