I need to use
find to locate a file matching a regex pattern in
filename.extension instead of the default, which matches
/folder |--a-love-song.ogg |--a-jazz-song.ogg +--love-songs +--a-blues-song.ogg
And I want to find, in
/folder and it's sub-directories, files with
.*love.* in the filename:
debian@debian:~$ find folder -regex ".*love.*" folder/a-love-song.ogg folder/love-songs # Shouldn't be returned folder/love-songs/a-blues-song.ogg # Shouldn't be returned
I read the man page and realize there is the option
-name, which searches only the filename, but it does not seem to allow regex, and
-name -regex does not work.
I tried using regex to ignore the path:
debian@debian:~$ find folder -regex "\/.*love.*$"
But it didn't return anything. Of course
ls | grep would work, but it doesn't return the path to the file, which I need in order to know where the file is.