@phils provided the answer (which should be accepted, IMO).
If you use library Dired+ then you can also do what you ask in some other ways.
In particular, commands, such as H
(dired-do-hardlink
), that normally act on the marked files and directories (or on the N next such) let you use a special prefix argument to act on all of the displayed files and dirs, regardless of which ones are marked.
This can be convenient when you have a set of markings that you don't want to change just to be able to issue a one-off command that acts on all files.
These are the special prefix arguments that provide this Dired+ feature:
C-u C-u
: all files listed - no directories (including .
and ..
)
C-u C-u C-u
: all files and directories listed except .
and ..
C-u C-u C-u C-u
: all files and directories listed (including .
and ..
)
(As usual, a numeric prefix arg N acts on the next N files and dirs (or the previous N if N is negative, and any other prefix arg means act on just the file or dir of the current line.)
So in your case, if you want to hard-link all of the files and directories except for .
and ..
then you could use C-u C-u C-u H
. And if you didn't want to hard-link any directories then you could use C-u C-u H
.