Need BASH script help
Brad De Vries
devriesbj at gmail.com
Thu May 15 13:33:14 BST 2008
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,
Actually, why do you have to use symbolic links? If you use a hard
link then the file's data is accessible directly from the filename --
no link traversal required.
Just a thought, albeit a good one. :-)
More information about the kubuntu-users