Hello!
My music library is organised in this structure:
/music/<artist>_<album>/
In every directory there's a file named
front_<artist>_<album>.jpg
The script should search in every directory for this file and create a softlink front.jpg on it.
Can you provide some input for the syntax of a bash script?
That would be highly appreciated.
THX
Script to create softlink for specific file in every dir
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Script to create softlink for specific file in every dir
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Script to create softlink for specific file in every dir
Not so hard, just one command:
Open a terminal on the music directory, and run it from there. It will find all the files beginning with front_ and ending in .jpg (case-insensitive, make it -name instead of -iname to make it a case-sensitive search). At the directory where it found those it will create a symbolic link to each and call it front.jpg. If you are in doubt, first only run the first part:
It will give you a list of all the commands it will run to create the symbolic links.
Hack on
Code: Select all
find . -iname front_\*.jpg -type f -printf "\"ln -s '%f' '%h/front.jpg'\"\n" | xargs -l bash -c
Code: Select all
find . -iname front_\*.jpg -type f -printf "\"ln -s '%f' '%h/front.jpg'\"\n"
Hack on