Background: I am trying to find music files that are mentioned in an xml file to organize my music playlists. I'm writing a script to pull out the filenames from the xml tag to automatically find the files.
My music lives in $musicroot
, so I'm issuing find
there. But I can't find the following file because of the []
characters.
find $musicroot -name "R. Kelly - Step In The Name Of Love [mp3clan.com].mp3" -type f
returns nothing, but if I escape the []
then it works.
find $musicroot -name "R. Kelly - Step In The Name Of Love \[mp3clan.com\].mp3" -type f
/mnt/Data/Dynamic/Multimedia/Music/Not Desi/Party/R. Kelly - Step In The Name Of Love [mp3clan.com].mp3
Note that in my script, the song file is iterated over in a loop of songs and exists in a variable $song
. Not sure if that makes a difference.
I'd really like to be able to just pass in the filenames into find
in my scripts without having to worry about escaping characters like this, but I can't seem to find anything on this online. Probably because it's hard to search for find
as find is such a common English word.
Is this possible?