Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to re-structure my mp3 directories. I currently have the following format:
artist-album-catalog-year
and I would like to rename the directories to:
catalog-artist-album-year
I was thinking of using a GUI mp3 tagging program, but most of my mp3's don't have a CATALOG tag. Also, I don't want to rename the files within the directories, just the directories themselves.
Since I don't have these directories I haven't tried the following so do it at your own risk.
Go to parent directory then:
Code:
for DIRNAME in `ls -d *`
do NEWDIRNAME=`echo $DIRNAME |awk -F- '{print $3"-"$1"-"$2"-"$4}'`
mv $DIRNAME $NEWDIRNAME
done
The awk -F- says to use awk to split the name up and use the dash (-) as the delimiter. This makes your original name 4 fields in the order you see them. The print statment moves what was the 3rd field to the 1st field in the ouput. You have to reinsert the "-" litterally there.
Try it first with "echo" in place of "mv" to insure it gives you what you want for old name and new name.
I am trying to re-structure my mp3 directories. I currently have the following format:
artist-album-catalog-year
and I would like to rename the directories to:
catalog-artist-album-year
I was thinking of using a GUI mp3 tagging program, but most of my mp3's don't have a CATALOG tag. Also, I don't want to rename the files within the directories, just the directories themselves.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.