With my limited knowledge of Linux tools, I hit a wall. Because my list of files contains spaces (space character), the "find" command fails to find any hits, but does not produce any errors. The reason for this script is to help with (re)transcoding of previously already transcoded files, such as music or movies.
searchdir="/volume2/" filename='list-in.txt' n=1 while read line; do echo "# $n : $line" FILES=${line%.*} find ${searchDir} -iname "$FILES.*" -type f n=$((n+1)) done < $filename I'm not sure where to go from here as awk or sed examples I found rarely deal with processing variables.
The input file would contain filenames in the form of:
Supertramp [The Very Best Of Supertramp] -05- Breakfast In America.m4a Supertramp [The Very Best Of Supertramp] -07- Take The Long Way Home.m4a Supertramp [The Very Best Of Supertramp] -09- Dreamer.m4a Not quote delimited, and no paths.
The output of the script would be the path and filename that best matches the above list, such as. Note that the source files and results have different file extensions:
/volume2/music/Supertramp/1990. The Very Best Of Supertramp/Supertramp [The Very Best Of Supertramp] -05- Breakfast In America.flac /volume2/music/Supertramp/1990. The Very Best Of Supertramp/Supertramp [The Very Best Of Supertramp] -07- Take The Long Way Home.flac /volume2/music/Supertramp/1990. The Very Best Of Supertramp/Supertramp [The Very Best Of Supertramp] -09- Dreamer.flac