same question pretty much. im working on a script to rename files. I found a mp3 rename script as follows
if [ "$1" ]
if [ -d "$1" ]
echo invalid directory
for i in *
NEWNAME=`echo "$i" | tr ' ' '_' | tr A-Z a-z | sed s/_-_/-/g`
if [ "$NEWNAME" != "$OLDNAME" ]
mv -v "$OLDNAME" "$TMPNAME"
mv -v "$TMPNAME" "$NEWNAME"
Im wanting to ls a working folder and feed the directories that reside in the working area into the rename tool.
Here's what I have so far, the last sed statement keeps putting "$CURDIR" instead of the value of pwd.
ls -R ./ *.mp3 | grep "./" | sed "s/:$//g" | sed s/^.\//$CURDIR/g
#For testing, will be removed once working
The problem is in the last sed statement.
Thanks guys. Oh, and this is not homework...for fun as Linux should be! Once working I'll share the working vesion with a "for" loop.