[linux-audio-user] batch creation of symlinks

Florian Paul Schmidt mista.tapas at gmx.net
Sun Jul 9 01:14:37 EDT 2006


On Sat, 08 Jul 2006 22:15:23 +0200
Hans <hansfong at zonnet.nl> wrote:

> Hello everyone,
> 
> Maybe not entirely related to music, so forgive me for that. I have been 
> busy with the following problem for sometime now and I can't seem to 
> figure it out.
> 
> 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
> 

find . -iname "foo.mp3" -exec ln -s \{\} ./  \;

Or something. This automatically takes care of whitespaces and other
hassles i think.

Flo

-- 
Palimm Palimm!
http://tapas.affenbande.org



More information about the Linux-audio-user mailing list