Author Topic: File symlinks not copied  (Read 5594 times)

Bone Reader

  • Newbie
  • *
  • Posts: 7
    • View Profile
File symlinks not copied
« 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".

  • When copying with drag&drop, the file symlinks are not copied at all.
  • When copying with copy&paste, the file to which the symlink points is copied, not the symlink 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.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: File symlinks not copied
« Reply #1 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..
 
« Last Edit: October 07, 2024, 11:05:00 by Mathias (Author) »

Bone Reader

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: File symlinks not copied
« Reply #2 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.
« Last Edit: October 07, 2024, 15:31:45 by Bone Reader »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: File symlinks not copied
« Reply #3 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.

Bone Reader

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: File symlinks not copied
« Reply #4 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.