[linux-audio-user] batch creation of symlinks

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: A list for linux audio users <linux-audio-user@...>
Date: Saturday, July 8, 2006 - 8:15 pm

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

with various variations, but it seems impossible to do it this way. What
is the right way to go about this? I know very little Python and some
bash scripting. I want to figure the solution out myself, so any
suggestions/hints related to Python/bash are more than welcome.

Cheers,

Hans

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[linux-audio-user] batch creation of symlinks, Hans, (Sat Jul 8, 8:15 pm)
Re: [linux-audio-user] batch creation of symlinks, Frank Barknecht, (Sun Jul 9, 9:17 am)
Re: [linux-audio-user] batch creation of symlinks, Florian Paul Schmidt, (Sun Jul 9, 5:10 pm)
Re: [linux-audio-user] batch creation of symlinks, Frank Barknecht, (Sun Jul 9, 10:28 pm)
Re: [linux-audio-user] batch creation of symlinks, Stephen Cameron, (Sun Jul 9, 4:26 pm)
Re: [linux-audio-user] batch creation of symlinks, Chris McCormick, (Sun Jul 9, 4:31 pm)
Re: [linux-audio-user] batch creation of symlinks, Frank Barknecht, (Sun Jul 9, 10:33 pm)
Re: [linux-audio-user] batch creation of symlinks, Frank Barknecht, (Sun Jul 9, 1:25 pm)
Re: [linux-audio-user] batch creation of symlinks, Florian Paul Schmidt, (Sun Jul 9, 5:14 am)
Re: [linux-audio-user] batch creation of symlinks, Florian Paul Schmidt, (Sun Jul 9, 5:26 am)
Re: [linux-audio-user] batch creation of symlinks, Stephen Cameron, (Sat Jul 8, 10:59 pm)
Re: [linux-audio-user] batch creation of symlinks, Emiliano Grilli, (Sat Jul 8, 8:28 pm)
Re: [linux-audio-user] batch creation of symlinks, Thomas Ilnseher, (Sat Jul 8, 9:15 pm)