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

Phil Mendelsohn phil at rephil.org
Sun Jul 9 12:07:45 EDT 2006


> Date: Sat, 08 Jul 2006 22:15:23 +0200
> From: Hans <hansfong at zonnet.nl>
> 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




More information about the Linux-audio-user mailing list