I have a file located at folderA/folderB/myFile
. This however is a relative address and I don't know where on my computer it is. myFile
has a very generic name and searching just for it will give me hundreds of results. So I am trying to search for the entire path.
After looking here, I tried these options:
find / -path folderA/folderB/myFile 2>/dev/null
find / -path "folderA/folderB/myFile" 2>/dev/null
However, neither returns any results even though I know with certainty that the file exists.
So how can I search for a file using its containing folder structure?
Best Answer
In your examples
folderA/folderB/myFile
is matched against the entire path. You need a wildcard, something like:Also note quoting is important. In general unquoted
*
triggers shell globbing (example).