LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2010, 03:37 PM   #1
cliffyao
LQ Newbie
 
Registered: Oct 2009
Posts: 27

Rep: Reputation: 15
can I create symbolic links for multiple files simutaneously


Hi, all

I have 5 files in directory /test1

file1.txt
file2.txt
..
file5.txt

I want to make symbolic links for all them to my current directory /test2

I tried

$ln -s /test1/*.txt .

but it failed. It seems like I can't make symbolic links for all the 5 files simultaneously.

Anybody knows how to solve this problem? Often times I need make symbolic links for multiple files with some common pattern (just like ".txt" here). I really hope to avoid making symbolic link for each of them one by one...

Any help will be greatly appreciated.

-Cliff
 
Old 02-18-2010, 03:52 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
link the directory instead.
 
Old 02-18-2010, 03:58 PM   #3
cliffyao
LQ Newbie
 
Registered: Oct 2009
Posts: 27

Original Poster
Rep: Reputation: 15
no, I can't.. In directory /test1, I have some other files which should not be linked.
 
Old 02-18-2010, 04:11 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Code:
for file in $(ls <path>|grep <something>); do ln -s <path>$file; done

Last edited by pixellany; 02-18-2010 at 06:03 PM. Reason: error--added another <path> placeholder
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create jar files with symbolic links alps963 Linux - General 1 05-03-2008 07:30 AM
make a copy of a directorystructure and his files as symbolic links Byenary Linux - General 4 04-25-2008 09:18 PM
How to create incrementing symbolic links from the output of a listing of devices no_treble Programming 8 02-07-2008 02:03 PM
KDE Random wallpaper or script to create symbolic links to random files cvelasquez Linux - Software 2 02-26-2007 07:48 PM
Multiple symbolic links 3saul Linux - Software 5 01-13-2006 09:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration