June 14, 20215 yr I have a folder full of symlinks pointing to folders with media in it. I use these to create custom libraries based on trakt lists for example. Now I want to copy the actual content which the symlinks point to a different folder. I've seen this asked many times on different forums, but none of the solutions seem to work. Strange thing is that I can do it with Krusader using the synchronize folders functionality, but I would like to have it done via a script. So say I have the following: /mnt/user/symlinks/ (full with symlinks) /mnt/user/selectedmedia/ (where the media should be copied to) What command can I use to get this done? Commands like: cp -Hr "/mnt/user/symlinks" "/mnt/user/selectedmedia/" Don't work, and either only copy the symlink or it errors in "no stat, no such file/directory". Hopefully someone knows the solution!
June 14, 20215 yr Author 1 hour ago, remotevisitor said: Look at using the rsync command with the -L option. Unfortunately this gives error that there is no referent. I think the problem is that the symlinks point to directories which contain files again. Also using -k doesn't solve it.
June 14, 20215 yr That error message is saying the directory that a symbolic link points at does not exists.
June 15, 20215 yr Author 10 hours ago, remotevisitor said: That error message is saying the directory that a symbolic link points at does not exists. Yeah that's the weird thing, because I can follow the links perfectly with Krusader. I use these links to play media from Plex, so they clearly work. But somehow the linux commands can't follow them.
June 15, 20215 yr You have probably created the symlinks with absolute references which are only valid within the mappings provided inside your dockers. Lets say you are mapping /mnt/users/Media -> /Media in a docker. Now you create a symlink in the docker to be something like /Media/Favourites/A_Film -> /Media/Films/A/A_Film then this works fine within the docker because /Media/Films/A/A_Film is a valid path within the docker. But /Media/Films/A/A_Film is not valid outside your docker. If the symlink had been created with relative references like /Media/Favourites/A_Film -> ../Films/A/Favourites/A_Film this it would work both inside and outside the docker because inside it resolves to /Media/Films/A/A_Film and outside it resolves to /mnt/users/Media/Films/A/A_Film. You could work around the problem outside the docker by creating the symbolic link /Media -> /mnt/users/Media because then /Media/Films/A/A_Film would now be valid.
June 16, 20215 yr Author On 6/15/2021 at 10:23 AM, remotevisitor said: You have probably created the symlinks with absolute references which are only valid within the mappings provided inside your dockers. Lets say you are mapping /mnt/users/Media -> /Media in a docker. Now you create a symlink in the docker to be something like /Media/Favourites/A_Film -> /Media/Films/A/A_Film then this works fine within the docker because /Media/Films/A/A_Film is a valid path within the docker. But /Media/Films/A/A_Film is not valid outside your docker. If the symlink had been created with relative references like /Media/Favourites/A_Film -> ../Films/A/Favourites/A_Film this it would work both inside and outside the docker because inside it resolves to /Media/Films/A/A_Film and outside it resolves to /mnt/users/Media/Films/A/A_Film. You could work around the problem outside the docker by creating the symbolic link /Media -> /mnt/users/Media because then /Media/Films/A/A_Film would now be valid. You're probably right. I use a script someone else created to create these symlinks, so I have no other way to change that. And I have not enough knowledge about symlinks to think about converting them. Quite unfortunate, just don't understand why Krusader can follow them through and the command lines can't. Thanks for thinking with me!
Archived
This topic is now archived and is closed to further replies.