4

So I want to symlink copy all the files and folders in one directory to another directory. When I use cp -s though without the -r option I get a bunch of "omitting directory" warnings, and I don't want to omit directories:

$ cp -s /home/my_username/path_to_directory/* .
cp: omitting directory `/home/my_username/path_to_directory/foo'
cp: omitting directory `/home/my_username/path_to_directory/bar'
cp: omitting directory `/home/my_username/path_to_directory/baz'

If I use the -r option though, it symlinks all the files in the directories instead of symlinking the directories themselves.

How do I non-recursively symlink all files and folders in one directory to another directory?

6

Nevermind, I figured it out. I can't believe I didn't try this sooner:

ln -s /home/my_username/path_to_directory/* .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.