Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create multiple soft links with one command UNIX
I recently had to make soft links to about 50 files. The shell was not expanding the wildcard (*) symbol as expected. The syntax for doing this with the 'ln' command is:
ln -s source_file target_file
After some experimentation I found the following works perfectly.
ln -s /path/to/source/* /path/to/target/directory/
This resulted in the wildcard being expanded into each of the file names and a soft link being made to each of the files in my target directory.
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Create multiple soft links with one command | 1 comments | Create New Account
Click here to return to the 'Create multiple soft links with one command' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: wealthychef on Feb 28, '02 05:18:46PM

As a corollary to this, you can also leave the target file name off completely if the link is to be made to the same directory you're in, which is often the case:

ln -s /path/to/a_file

This creates a link to a_file in the current working directory, i.e., there is an implied '.' argument.

[ Reply to This | # ]