does hardlink
's --exclude
prevent descending a directory?
#3244
-
Does/can I have two directories I want to hardlink where I could save a lot of time and computation by being able to prevent descending one particular subdirectory in each of the two directories. If I were using |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
hardlink visits every regular file in the tree, and the --include / --exclude expressions are applied for each file. So, it does not prevent the visit of any subdirectory. The expression is applied to the file names, not to directory names (it internally ignores directories). |
Beta Was this translation helpful? Give feedback.
-
I wonder if, while you are at it, a |
Beta Was this translation helpful? Give feedback.
-
Should be implemented by PR: #3261 |
Beta Was this translation helpful? Give feedback.
-
The expression is used with a full path when entering the directory. So, the directory name is the last item in the path -- it means it's a string after the last '/'. For example, if I have:
It makes sense to use '/' after the directory name only if you want to check the parental directory too. For example |
Beta Was this translation helpful? Give feedback.
Ah, good point.
I had no clue that nftw() can react to the callback's return value in a smart way (FTW_ACTIONRETVAL). Yes, it seems we can implement --exclude-subtree easily :-)