Recursive symbolic linking question

Uncle Jim jim at jimani.com
Mon Jun 13 20:57:53 CDT 2005


Hi,

On Mon, Jun 13, 2005 at 04:21:11PM -0500, Rob Becker wrote:
> 
> I have a bunch of oggs in a partition called autotunes that are
> organized into directories by artist and then subdirectories by album.
> I am using ogg123 to play the files.  As best I can tell, ogg123 does
> not have the ability to recursively select files from a nested directory
> structure.  I need to have a symbolic link for each ogg appear in the
> /autotunes directory.  I can get a list of all the oggs by just using
> locate *.ogg.  I can dump that to a file with a redirection, but how can
> I use that file to create the symbolic links automatically?  I assume
> that I'm needing to write a script to accomplish this task.  I'm not at

You don't need to dump the list to a file, just do the locate in the
script.  Sample bash script:

  for ogg_file in $(locate *.ogg)
  do
    ln -s ${ogg_file} /dest/dir
  done

Or you could use find:

  find /top/of/ogg/tree -name "*.ogg" -exec ln -s {} /dest/dir \;

-- 
Jim


More information about the Kclug mailing list