Need BASH script help

Jared Greenwald greenwaldjared at gmail.com
Thu May 15 02:26:45 BST 2008


Something like this?  I always remember the ln format by using real
and fake hence the var names.

cd /big/sda
find Sorted -type l -name "*avi" | while read fake ; do
  real="../../../moviesa/"${fake##*/}
  ln -svf $real $fake
done

I make no guarantee that it will work, just a suggestion.  You should
probably replace the ln line with 'echo "$real::$fake"' and run that
once to make sure that its going to be doing what you want.

On Wed, May 14, 2008 at 8:25 PM, Joel Oliver <joelol75 at verizon.net> wrote:
> Hello, I was wondering if there's anyone who can help me with my problem.
>
> OK.... I have a huge directory of movies (1200+) all in one directory
> and I wanted to "divide" them up...  Smarty me comes up with a great
> idea... symbolic links...  Now it would take forever to go into the
> terminal and ln -s every file so I discovered konqueror does this with a
> drag and drop... Great!  So dragging and dropping away I sorted all my
> movies alphebetically, by release date, by actors/actresses...  All was
> well except one BIG thing...
>
> I play them on my neuros OSD and mount them via NFS.   Konqueror really
> botched this as it created absolute path links and I needed relative
> paths....like it did this:
>
> my movies are in /big/sda/moviesa/
>
> my OSD mounts this in /mnt/media/nfs
>
> so the path after the mount is /mnt/media/nfs/sda/moviesa
>
> my sorted symbolic links are in /big/sda/Sorted/Alphebetical/A/movie.avi
> and these are linked like /big/sda/moviesa/movie.avi which is great on
> the computer but the path is wrong on the OSD.  I thought I could
> 'trick' the OSD with a symbolic link right in the root of the drive, but
> this area is solid state and won't let me write to it... So the big ?:
>
> Is there an easy recursive way to recurse through a whole directory
> structure, chop off the /big/sda and replace it with a relative ../../..
>
> If I link it as ../../../moviesa/movie.avi it works on both machines....
> But that's alot of files to do one-by-one and I'm kinda stumped...
>
> Any quick ideas?  I realize this will work with every file as long as I
> keep all my links on the 3rd layer... otherwise I would need more or
> less "..'s"      :)
>
> Thanks in advance,
> Joel.
>
>
> --
> kubuntu-users mailing list
> kubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
>



More information about the kubuntu-users mailing list