为了按名称查找文件,我使用以下命令:
find . /home/XYZ/ -name '*abc*'
但它会在XYZ目录及其子目录中显示结果。我只需要在特定的文件夹“XYZ”中搜索,而不是在子目录中搜索。我怎样才能做到这一点呢?
huwehgph1#
find . XYZ/ -maxdepth 1 -name *abc*
输出
find . XYZ/ -maxdepth 1 -name *abc* XYZ/abc.txt find . XYZ/ -name *abc* ./XYZ/abc.txt ./XYZ/tuv/123abc XYZ/abc.txt XYZ/tuv/123abc
man find -maxdepth levels Descend at most levels (a non-negative integer) levels of directories below the starting-points. Using -maxdepth 0 means only apply the tests and actions to the starting-points themselves.
1条答案
按热度按时间huwehgph1#
输出