Pages

How do I tell 'find' to skip all symlink folders?

dimanche 7 août 2016

This must have been answered somewhere, but Google as I might, I cannot find the answer.

According to the find manual, you can use -P (which is default anyway) to prevent it from following symlinks.

But, this applies only to flies. What I want is for find to not follow any folders that are symlinks.

For example, suppose the folder structure is as follows.

Code:

.
├── folderA
│   ├── folderAA
│   └── folderAB
├── folderB
│   ├── folderBA
│   └── folderBB
└── linkToOutside -> /somewhere/else/outsideA/
I want to use find, but tell it to search only folderA and folderB, and exclude folder linkToOutside (because it is a symlink).

I have tried the following options but to no avail:

Code:

find -P -xdev '!' -type l
How do I tell find to skip all symlink folders?

Let's block ads! (Why?)



How do I tell 'find' to skip all symlink folders?

Aucun commentaire:

Enregistrer un commentaire