I'm looking for how to recursively copy a directory structure and then fill the copy with symlinks to the corresponding files from the source directory. This has a simple solution in Linux in the form of cp -as
, but cp
seems to lack the s
option on macOS Mojave.
The underlying goal is to automate the process of making applications that do not reside in /Applications
show up in Launchpad.
What would be an elegant, preferrably future proof, alternative to this on macOS?
From doing brew search cp
I get the impression that Homebrew does not have an alternative version of cp
.
Update
Additional information
I'm currently running this regularly, but I want to improve it by making it recursive:
ln -s /<Source app directory>/*.app /Applications
It also has to preserve the directory structure because:
-
Subdirectories are used to manage sets of applications that are to be excluded from backup, without having to manually change Time Machine settings every time I add a new application. For instance, games are large and do not need to be backed up. Same goes for versions of Xcode.
-
A mere symlink to a subdirectory does not include its linked target's applications in Launchpad.
-
A symlinked directory would prevent creating a real directory with the same name. That prevents the source and destination directories from being organised identically.
Best Answer
The GNU version of
cp
is part ofcoreutils
It gets installed as
gcp
to avoid conflicts with the BSD version ofcp
(which behaves differently for some arguments).