I have a directory with folder structure as follows:
DATA -- ABD 1231345 -- 2012_01_08
-- 2012_03_09
-- 2012_06_11
-- DEF 4859480 -- 2012_02_10
-- 2012_05_10
-- 2012_07_10
What I’m trying to do is:
cd DATA- run a bash script (while in
/DATA) that will rename all first-child folders from
ABD 1231345
to
ABD_1231345
Do you have a suggestion on how to accomplish using command line on Mac OSX / unix?
Note that the
${i//string/repl}syntax is a non-standard extension of sh, but you can do the same thing portably with something like: