How-to Copy symbolic links itself, not the content?

English support forum

Moderators: white, Hacker, petermad, Stefan2

redfox
Junior Member
Junior Member
Posts: 98
Joined: 2015-02-09, 11:36 UTC
Location: Czech Republic

How-to Copy symbolic links itself, not the content?

Post by *redfox »

Is it possible to copy symbolic links in TC 8 or 9 beta, created in Windows with mklink /d?

When I try to copy the link using F5, it copies the whole content of the target directory, just not the link itself.

Thanks
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

From the help "Settings in the file wincmd.ini (Part 1)":

CopyLinks=1 Copy file system links (junctions) as links and not as directories:
0: Copy links as dirs or ignore them (if IgnoreLinks has been set)
1: Copy links without changing the target path of the links
2: Copy links and change the target path to the target drive if the link points to the same drive on which the link itself is located.
Example:
c:\path1\link, pointing to c:\path1\path2\linktarget
Copied to d:\trgpath1\trgpath2\link
-> Link now points to d:\trgpath1\trgpath2\path2\linktarget
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
redfox
Junior Member
Junior Member
Posts: 98
Joined: 2015-02-09, 11:36 UTC
Location: Czech Republic

Post by *redfox »

Thank you, it works as expected.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

But I don't recommend using this option because it may cause data loss if you will need to make a backup copy of this folder.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

MVV wrote:But I don't recommend using this option because it may cause data loss if you will need to make a backup copy of this folder.
I suggest the opposite.
Backups are made by backup the targets where they are.
Following links produces in almost all cases duplicate backups.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I forgot to disable this option and copied a folder with junctions in order to backup it... but got only junctions. This is dangerous.
User avatar
HerbieH
Member
Member
Posts: 145
Joined: 2003-02-11, 10:04 UTC

Post by *HerbieH »

I agree with both MVV and Horst.Epp, - and that's the beauty of Total Commander. You decide for yourself the level of danger, you want to have. :)

My choice is to keep using TC in the 'old' way, and always make it copy the contents(!) of the symbolic links - BUT - when I have to copy symbolic links (etc.) as links, I use the freeware program 'Fastcopy' (by S. Hiroaki) which can be nicely configured, and it is easy to implement in TC's menu system.

In that way, it is hard, NOT to remember, how symbolic links are dealt with, when they are copied. :)
HerbieH*
-Keep on makin' music!
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It would be nicer to have an option in copy dialog anyway, and it was requested more than once...
ylupien
New Member
New Member
Posts: 1
Joined: 2018-03-28, 17:16 UTC
Location: Deux-Montagnes

Post by *ylupien »

I made a big mistake using total commander. I moved a folder containing symlink and it has copied & moved all files under the symlink. Move operation has removed all files under a location that is not belong the folder I moved. Moving these files under the symlink is dangerous.

I think it should work like unix commands. When you want to copy content, you should specify -L, --dereference (always follow symbolic links in SOURCE) if you don't specify it copy the symlink.

In total commander we should have a checkbox (dereference) in copy / move and delete interface.
LeeBinder
Junior Member
Junior Member
Posts: 14
Joined: 2009-07-18, 23:09 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *LeeBinder »

me too!!! PLEASE add the available options..
  • into Settings/ Copy options
  • into the copy dialog options
THANK YOU CHRISTIAN!
User avatar
Impeeza
Junior Member
Junior Member
Posts: 24
Joined: 2004-04-30, 15:04 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *Impeeza »

Hi, regards from Colombia, I affix to the motion, every time I need to change the behavior of symbolic lynks copy, end in this thread, I have Dori's memory ha ha ha :lol: . If will possible to add the setting in the copy dialog, will be super. Thanks a lot for all your effort.
Impeeza jaja
rahreg
Junior Member
Junior Member
Posts: 8
Joined: 2022-10-04, 19:32 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *rahreg »

Hi,

I know this is an old thread but I think I'm having the same issue that redfox had but the suggestion is not working for me.

I want to create a directory structure for the Marvel Comics TV Shows and Movies. And I want there to be an MCU directory that has everything in the right order, but I also want the films and tv shows to be under specific character directories without duplicating the contents. So:

marvel\mcu\infinity saga\phase 1\1-iron man
marvel\mcu\infinity saga\phase 1\2-the incredible hulk
marvel\mcu\infinity saga\phase 1\3-thor
marvel\mcu\infinity saga\phase 1\4-iron man 2
marvel\mcu\infinity saga\phase 1\5-captain america the first avenger
marvel\mcu\infinity saga\phase 1\6-the avengers
marvel\mcu\infinity saga\phase 3\1-black widow
marvel\mcu\infinity saga\phase 3\2-wanda vision

So the content will be in those directories. Then I want to have:
marvel\films\iron man -- link to marvel\mcu\infinity saga\phase 1\1-iron man
marvel\films\iron man 2 -- link to marvel\mcu\infinity saga\phase 1\4-iron man 2
marvel\films\thor -- link to marvel\mcu\infinity saga\phase 1\3-thor
marvel\tv\wanda vision - link to marvel\mcu\infinity saga\phase 3\2-wanda vision
etc for the others
Also notice I changed the name of the link to remove the leading order number

And I want to have:
marvel\characters\iron man with links to both 1-iron man and 4-iron man 2
etc for the others

When I want to backup the marvel directory, I want the links to copy to the target as links relative to the target location and not copy the contents of the original source to the target link location.

I've tried xcopy with both symbolic links and junctions and those don't work. So I found this thread and I tried manually editing the wincmd.ini file, adding CopyLinks under [Configuration] and tried 1 and 2 and both copied the links as actual directories as well as copied the contents. I thought =2 would work but it didn't. I also closed TC before I made the change and restarted it after making the change to make sure it read the new setting.

This is TC 10.50 x64 on Win 10 (although I will really be doing this on Win 7). Did I do something wrong? Also, which would be better--symbolic links or junctions?

Please help.
Thanks
rahreg
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *Fla$her »

2rahreg
1. Open marvel\movies\ In the passive panel.
2. Press Ctrl+B on the active panel with marvel\mcu\infinity saga\phase 1.
3. Select the desired files and click the button with NTLinksMaker (with system bitness):
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\
Utils\NTLinksMaker\NTLinksMaker.exe
/b /q /sr? /r="%P" "@%WL" "%T*"

Utils\NTLinksMaker\NTLinksMaker.exe
Create symbolic links in another panel
Overquoting is evil! 👎
rahreg
Junior Member
Junior Member
Posts: 8
Joined: 2022-10-04, 19:32 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *rahreg »

Fla$her wrote: 2022-10-07, 16:33 UTC 2rahreg
1. Open marvel\movies\ In the passive panel.
2. Press Ctrl+B on the active panel with marvel\mcu\infinity saga\phase 1.
3. Select the desired files and click the button with NTLinksMaker (with system bitness):
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\
Utils\NTLinksMaker\NTLinksMaker.exe
/b /q /sr? /r="%P" "@%WL" "%T*"

Utils\NTLinksMaker\NTLinksMaker.exe
Create symbolic links in another panel
Hi Fla$her, thanks for the response. I actually want the links to be on the directory not the file so I hope what you are recommending will work for that. Unfortunately I don't understand what you are saying for #3.

What does system bitness mean?
Is NTLinksMaker a TC plugin?
Does it install the button?
What am I supposed to do with the code you quoted?
Where do I get NTLinksMaker? I googled it and tried totalcmd.net but there was a problem going to that site. Other sites don't look safe, and I don't see it listed on https://www.ghisler.com/plugins.htm

But will this allow me to copy a structure to another drive, keep the links relative to the target, and not double copy the files? And do it from TC?

Also any ideas why changing the ini file didn't work?

Thanks
rahreg
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: How-to Copy symbolic links itself, not the content?

Post by *Fla$her »

rahreg wrote: 2022-10-08, 00:22 UTCI actually want the links to be on the directory not the file
Links to folders? Then I misunderstood the task. In this case, this tool will not fully work, because you need to change the names of the link folders according to the list of correspondences. Here we need a loop with the utility ln.exe. I can help with that later.
rahreg wrote: 2022-10-08, 00:22 UTCWhat does system bitness mean?
Windows architecture: 32/64 bit.
rahreg wrote: 2022-10-08, 00:22 UTCIs NTLinksMaker a TC plugin? Where do I get NTLinksMaker?
No, it's a utility/addon.
rahreg wrote: 2022-10-08, 00:22 UTCDoes it install the button?
I don't understand the question. You insert the button by code from the clipboard yourself through the context menu of the toolbar.
rahreg wrote: 2022-10-08, 00:22 UTCWhat am I supposed to do with the code you quoted?
Already nothing. Need another.
Overquoting is evil! 👎
Post Reply