Using symlinks with the NTV550

Here's the place for announcements & news
User avatar
Ian
Moderator
Posts: 752
Joined: January 1st, 2011, 7:00 am

Re: Using symlinks with the NTV550

Post by Ian »

Hi bruuss,

I would expect errors to get thrown up along the way as the script runs through. Do you spot any such error messages? Maybe they look harmless and so you're missing them. If you'd like to dump the output in your next post I can take a look.

Re your files not being linked. The script creates links to folders, not files, and so if the folders are being linked but you can't see the files in them then this could be down to a permission problem. Maybe you could send me the output of the ls -l command for the contents of those folders and I might spot something odd.

With regards links being created in both the source and dest folders, this indicates something has gone wrong with the script and an error should get thrown up. The way the script works is as follows: It cd's into the dest folder and then issues the link command "ln -s name_and_location_of_original_folder_or_file new_name". If the link is created in the source folder then the change directory command is failing.

If you edit the script and add pwd after the line which reads cd "$_DFolder" which is line 41 in my original script then you'll see what folder the script is in as it creates the links. Perhaps also remove the # from the start of line 67 (which reads # echo Linking \""$(basename "$file")"\" to \""$file"\") then you'll see exactly what command is being issued to create the symlink.

Let me know how you get on. :thumbup:

Ian.
acme
Member
Member
Posts: 13
Joined: December 14th, 2011, 8:38 pm

Re: Using symlinks with the NTV550

Post by acme »

Howdy,

I am attempting to get the symlinks working on my server, but no joy!

When I run the script via Putty I get the following error

Code: Select all

serveradmin@Server:~$ sudo /home/serveradmin/MyScripts/symlinks.sh
/home/serveradmin/MyScripts/symlinks.sh: 1: POSE:: not found
/home/serveradmin/MyScripts/symlinks.sh: 19: Syntax error: "(" unexpected (expecting "}")


Thanks for any help.

Craig
User avatar
Ian
Moderator
Posts: 752
Joined: January 1st, 2011, 7:00 am

Re: Using symlinks with the NTV550

Post by Ian »

Hi Craig,

The cause of this error doesn't jump out at me. Could you show me the script please. Attach it as a .txt file to your next post and I'll try my best to help.

Thanks,

Ian.
acme
Member
Member
Posts: 13
Joined: December 14th, 2011, 8:38 pm

Re: Using symlinks with the NTV550

Post by acme »

Thanks Ian.

Previous attempts failed because of Permissions...

Using 11.04 64 bit
Attachments
symlinks.txt
(3.82 KiB) Downloaded 561 times
User avatar
Ian
Moderator
Posts: 752
Joined: January 1st, 2011, 7:00 am

Re: Using symlinks with the NTV550

Post by Ian »

Hi Craig,

OK, the very first line of your script needs a #. So instead of reading

Code: Select all

POSE: Script to create symlinks to reduce entry points to make browsing easier on the NG streamers


it should read

Code: Select all

#POSE: Script to create symlinks to reduce entry points to make browsing easier on the NG streamers


BUT, before this line you need to add this line:

#!/bin/bash


So the first two lines of your script should now read like this

Code: Select all

#!/bin/bash
#POSE: Script to create symlinks to reduce entry points to make browsing easier on the NG streamers


Now run the code again and let me know what happens.

Good luck :thumbup:

Ian.
acme
Member
Member
Posts: 13
Joined: December 14th, 2011, 8:38 pm

Re: Using symlinks with the NTV550

Post by acme »

OK that ran...just trying to get my win head around this...sorry for so many questions...
This is actually working on my PS3 media server.
It shows a couple of Cover folders which contain another Cover folder and the cover.jpg and it goes to infinity as far as I can see. Also how can I get rid of the lost+found folders?
This script does not link any single files, is that correct? None of my single movies out side of a folder are linked (show up in the linked folder).
I now see a down arrow on the folder icon Image I presume that means its linked. Making changes to the original folders will then change the synlinks (when script is run again), correct?
What are the cautions with changing (deleting, renaming) folders/files with the down arrow?
User avatar
Ian
Moderator
Posts: 752
Joined: January 1st, 2011, 7:00 am

Re: Using symlinks with the NTV550

Post by Ian »

acme wrote:It shows a couple of Cover folders which contain another Cover folder and the cover.jpg and it goes to infinity as far as I can see. Also how can I get rid of the lost+found folders?


Good question. I have a main folder which I point the script to and it links from there downwards. I guess you're pointing at root? I'm not sure how to ignore the lost+found folders to be honest. My suggestion would be to create a "main folder" and then move everything you want into it and then point the script at that.

acme wrote:This script does not link any single files, is that correct? None of my single movies out side of a folder are linked (show up in the linked folder).


Correct. It creates links for folders so only those folders that you point the script to plus all folders below those folders get linked.

acme wrote:I now see a down arrow on the folder icon Image I presume that means its linked. Making changes to the original folders will then change the synlinks (when script is run again), correct?


Correct.

acme wrote:What are the cautions with changing (deleting, renaming) folders/files with the down arrow?


Assuming these are folders that the script has created (I'm not sure where you're seeing them. Are you viewing them via a windows machine?) and are thus just links to the folder and not the folder itself then you can delete them as you wish. Obviously tho, if you don't change the source folders but re-run the script then those linked folders will reappear.

Ian.
acme
Member
Member
Posts: 13
Joined: December 14th, 2011, 8:38 pm

Re: Using symlinks with the NTV550

Post by acme »

Great, thanks Ian for a great resource!

I will make a few changes, from what you mentioned and go forward. This has been a fun project, which I share with any one that will listen...
Post Reply