[linux-audio-user] Re: batch creation of symlinks

From: Phil Mendelsohn <phil@email-addr-hidden>
Date: Sun Jul 09 2006 - 19:07:45 EEST

> Date: Sat, 08 Jul 2006 22:15:23 +0200
> From: Hans <hansfong@email-addr-hidden>
> Subject: [linux-audio-user] batch creation of symlinks

> I want to batch create symlinks in the main directory, of all the files
> in subdirectories. E.g.
>
> $ls
> dir1
> dir2
> dir3
> file1.mp3 -> .dir1/file1.mp3
> file2.mp3 -> .dir1/file2.mp3
> file3.mp3 -> .dir2/file3.mp3
> file4.mp3 -> .dir2/file4.mp3
> file5.mp3 -> .dir3/file5.mp3
> file6.mp3 -> .dir3/file6.mp3
>
> I tried various shell thingies like:
>
> for i in *.mp3; do ln -s --target-directory=../ $i $i; done
>
> in the subdir, or
>
> for i in ./dir1/*.mp3; do ln -s $i $i;done

You might find this useful. (cp -s rocks!)

cd $TARGETDIR
(any loop stuff)
  cp -s $FROMDIR *.mp3 ./

Cheers,
Phil

-- 
Dept. of Mathematics, 342 Machray Hall
U. of Manitoba, Winnipeg, Manitoba, Canada R3T 2N2
Office:  446 Machray Hall, 204-474-6470
http://www.rephil.org/   phil at rephil dot org
Received on Sun Jul 9 20:15:03 2006

This archive was generated by hypermail 2.1.8 : Sun Jul 09 2006 - 20:15:03 EEST