Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: Bone Reader on September 30, 2024, 15:37:38

Title: File symlinks not copied
Post by: Bone Reader on September 30, 2024, 15:37:38
When copying file symlinks or directories that contain file symlinks, the symlinks are not copied.

In core settings / tab "Filesystem" / section "Junctions and Symbolic links", the option "when copying or moving" is set to "Copy or move the link itself".


Moving file symlinks works as expected with drag&drop and with copy&paste. The symlinks themselves are moved in both cases and not the files they points to.

With copy it should be the same way.
Title: Re: File symlinks not copied
Post by: Mathias (Author) on October 07, 2024, 10:55:26
Works for me..

I got
C:\MyFolder\MyFolder ( SymLnk => D:\MyFolder )
C:\MyFolder\Myfile.jpg ( SymLnk => D:\MyFile.jpg)

If I have the option to "copy or move the link itself" enabled.
Then Drag and Drop C:\MyFolder to E:\

I Get

E:\MyFolder\MyFolder ( SymLnk => D:\MyFolder )
E:\MyFolder\Myfile.jpg ( SymLnk => D:\MyFile.jpg)

Using Copy / Paste , Then the copy process is not handled my MC. Then you are using Standard windows shell for copying.

If you enable fileoperations logging in Core settings logging and the view Ctrl+L  does it show any any reason or error..
 
Title: Re: File symlinks not copied
Post by: Bone Reader on October 07, 2024, 15:27:46
Thanks for the reply.

If I do it exactly as you described, I get the same result as you (I love determinism :) ).

However my use case is a bit different:

I have:
C:\MyFolder\MyFile.txt
C:\MyFolder\SubFolder\MyFile.txt ( Symlink -> "..\MyFile.txt" )

I don't know whether the symlink with relative path can be created with MC. I created it via the command line:

mklink C:\MyFolder\SubFolder\MyFile.txt ..\MyFile.txt

When I drag&drop C:\MyFolder to D:\, the directory "D:\MyFolder\SubFolder" exists, but is empty, i.e. the symlink is not copied.

Experimenting a bit I found that when the symlink contains an absolute path to the target file (-> "C:\MyFolder\MyFile.txt"), it is correctly copied.
Having a symlink with an absolute path to a file that does not exist, has the same effect as with the relative path: the symlink is not copied.

There seems to be some check, whether the link target exists. Maybe in case of the relative path, the symlink is copied before the file and therefore the link target does not (yet) exist.

In my opinion no checks concerning the link target should be made. The symlink should always be copied and it should contain exactly the same target as the original, no matter whether it can be resolved to an existing file at the new location or not.
Title: Re: File symlinks not copied
Post by: Mathias (Author) on October 07, 2024, 16:51:25
Ah does not exists.. Yes it check when creating the file that the target exists..
Symlink can be created to none existing files/folders. So I think I can remove that check.
Title: Re: File symlinks not copied
Post by: Bone Reader on October 07, 2024, 20:07:17
Thanks for confirming the assumption.

It would be great, if you removed that check.
Currently it's not possible to copy a directory to a different volume and restore it later to the original location, without possibly losing some symlinks.