View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-06-2005, 12:49 PM   #1
Registered: Dec 2003
Distribution: FC2
Posts: 38

Rep: Reputation: 15
symlink multiple files to new directory with new extension

I need to symlink multiple files to a different directory changing the extension of each file.
When I execute
ln -s /dir/*.123 /dir/*.321
I get
"ln: when making multiple links, last argument must be a directory"

What can I do to create a symlink of multiple files into a different directory changing the extension?

Old 01-06-2005, 12:55 PM   #2
Registered: Jun 2004
Location: Melbourne, Australia
Distribution: Slackware 9.1
Posts: 33

Rep: Reputation: 15

for file in /dir/*.123 ; do
  ln -s $file `echo $file | sed 's/123$/321/'`
I haven't tested it but it should work no probs! Just make sure you change the right things in it (if you wanted to change mp3 to ogg you'd change s/123$/321/ to s/mp3$/ogg/ and /dir/*.123 to /dir/*.mp3)

edit: added code tags, whoops!


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files from multiple directories into one directory MadRabbit Linux - Newbie 8 02-07-2014 07:56 PM
Changing extension of multiple files harisund Programming 17 06-01-2006 10:59 AM
divide a directory into multiple archive files with par ddaas Linux - General 1 02-26-2005 01:52 PM
changing extension of multiple files shaggystyle Linux - General 5 01-29-2004 12:35 PM
How do I decompress and desarchive multiple .tar.gz files to a single directory? Baldorg Linux - Software 7 11-27-2003 12:42 PM

All times are GMT -5. The time now is 02:29 AM.

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