Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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

ln -s /home/my_username/path_to_directory/* .
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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