Warm tip: This article is reproduced from serverfault.com, please click

find full path given partial path

发布于 2016-04-25 19:03:34

I know how to find files using

find . -name "file_name"

But if I am given one part of a path, say "folder1/subfolder2/", how do I get all the full path that contains this partial path?

Example

partial path: folder1/subfolder2/

desire result:

/bob/folder1/subfolder2/yo/
/sandy/folder1/subfolder2/hi/
Questioner
James the Great
Viewed
0
1 2020-08-10 17:57:01

Use the -path option:

find . -path '*/folder1/subfolder2/*'