rupeshforu3
Disciple
Hi I am Rupesh from India and I have a pc with Intel i3 10th gen processor and I have installed windows 11 and Arch Linux. I have 10 gb of MP3 files in various sub directories and I want to add text like 128 kbps or 250 kbps to the last directory in the path.
I have mp3 files in the following pattern
music/dir1/dir2/dir3/song1.mp3
music/dir1/dir2/song2.mp3
My requirement is I want to move mp3 files as following
music/dir1/dir2/dir3 128 kbps/song1.mp3
music/dir1/dir2/song2.mp3
Every root directory consists of various sub directories and mp3 files. I just want to add text 128 kbps to the name of last directory in the path.
Previously I have experimented with directories in bash to obtain the last directory in the following way.
I think that it may be useful in our task.
Here another requirement is dir2 consists of one mp3 with name song2.mp3 and another sub directory and so any text must not be added to the name of dir2 I mean dir2 must not be renamed as dir2 128 kbps.
I have tried bulk rename utility like advanced renamer in windows 11 by adding music folder in it but unfortunately it is renaming all directories present in path ie., dir1 to dir1 128 kbps, dir2 to dir2 128 kbps, dir3 to dir3 128 kbps.
At present I am learning slowly unix and linux concepts and it may take atleast one year for to write a script on my own.
Kindly try to suggest a bash script to accomplish this task.
Regards,
Rupesh.
I have mp3 files in the following pattern
music/dir1/dir2/dir3/song1.mp3
music/dir1/dir2/song2.mp3
My requirement is I want to move mp3 files as following
music/dir1/dir2/dir3 128 kbps/song1.mp3
music/dir1/dir2/song2.mp3
Every root directory consists of various sub directories and mp3 files. I just want to add text 128 kbps to the name of last directory in the path.
Previously I have experimented with directories in bash to obtain the last directory in the following way.
Code:
$:\ rev source_names.txt > rev.txt
$:\ cut -f1 -d'/' rev.txt > temp.txt
$:\ rev temp.txt > extracted_names.txt
I think that it may be useful in our task.
Here another requirement is dir2 consists of one mp3 with name song2.mp3 and another sub directory and so any text must not be added to the name of dir2 I mean dir2 must not be renamed as dir2 128 kbps.
I have tried bulk rename utility like advanced renamer in windows 11 by adding music folder in it but unfortunately it is renaming all directories present in path ie., dir1 to dir1 128 kbps, dir2 to dir2 128 kbps, dir3 to dir3 128 kbps.
At present I am learning slowly unix and linux concepts and it may take atleast one year for to write a script on my own.
Kindly try to suggest a bash script to accomplish this task.
Regards,
Rupesh.