How to find files excluding symbolic links?

前端 未结 6 1511
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-02 05:14

I want to find files in Linux that follow a certain pattern but I am not interested in symbolic links.

There doesn\'t seem to be an option to the find comm

6条回答
  •  不要未来只要你来
    2021-02-02 05:45

    Like @AquariusPower say, the use of find -type f -xtype f solved my problem, and now I get only real files and not symbolic links anymore.

    From: https://linux.die.net/man/1/find

    I got:

    -xtype c The same as -type unless the file is a symbolic link. For symbolic links: if the -H or -P option was specified, true if the file is a link to a file of type c; if the -L option has been given, true if c is 'l'. In other words, for symbolic links, -xtype checks the type of the file that -type does not check.

    Thanks.

提交回复
热议问题