The -wholename
option to find
allows you to specify pathname components along with a glob to locate files in your filesystem. You should try and tailor the start directory as much as possible, but you can start with /
if you really have no idea where the file could be located.
In that case, you could do:
find / -type f -wholename "*a/b/c/1.txt"
You can also use locate
(mlocate) which uses -wholename
matching by default. An equivalent search with locate
would be:
locate "*/a/b/c/1.txt"
The caveat is that updatedb
must have been run since the file was created for it to be in the mlocate.db
. Otherwise, the file won't be found with locate
. (also note, locate
is not installed by default in by all Linux distros)
glob.glob("/data/users/*/u/a/b/c/1.txt")
docs.python.org/3/library/glob.html