How to only find files in a given directory, and ignore subdirectories using bash

后端 未结 5 596
礼貌的吻别
礼貌的吻别 2021-01-30 05:45

I\'m running the find command to find certain files, but some files in sub-directories have the same name which I want to ignore.

I\'m interested in files/pa

5条回答
  •  终归单人心
    2021-01-30 06:36

    Is there any particular reason that you need to use find? You can just use ls to find files that match a pattern in a directory.

    ls /dev/abc-*
    

    If you do need to use find, you can use the -maxdepth 1 switch to only apply to the specified directory.

提交回复
热议问题