You should be using -type
and not -xtype
:
-xtype c
The same as -type unless the file is a symbolic link. For sym‐
bolic 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.
The default is -P
, so the -xtype option will try to determine the resultant file, not the symlink itself. Actually, I get some positive results, which seems like a bug. The -P -xtype l
should return true (on a symlink) iff the resultant is itself a symbolic link.
Can also use: ls -FA | sed -ne 's/@//p'
which will display only the symlinks.
man find
shows that-d
is a synonym for-depth
(for compatibility with FreeBSD, NetBSD, MacOS X and OpenBSD.), ie. it is not the same as-maxdepth
. . .-depth
Process each directory's contents before the directory itself