copy symlinks as symlinks

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
byblo
Senior Member
Senior Member
Posts: 270
Joined: 2005-02-20, 21:13 UTC
Contact:

Re: copy symlinks as symlinks

Post by *byblo »

Indeed hardlink and symbolic files are different type of link. TC already detect if a file is a link type or not (can see in TC's default size column, a symbolic file is showing a <LNK>. edit:It also has the tc.file type column.. So the detection functions seems to be already there.)

This is also why i do not understand why the feature to also copy/move/sync symbolic files as symbolic or normal(as now) or ignore is not added yet to TC :s

For hardlink files, it does not seems to matter. Copying a hardlinked file into a normal type is no problem, unless user is trying to backup his OS manually on some backup folder and will use it to restore the system...

edit2: btw, i wrote a table that showing the current status of TC regarding the link types. See the picture linked from this topic: https://www.ghisler.ch/board/viewtopic.php?f=3&t=56956
pbpb
Junior Member
Junior Member
Posts: 2
Joined: 2020-08-01, 00:19 UTC

Re: copy symlinks as symlinks

Post by *pbpb »

umbra wrote: 2019-12-24, 12:24 UTC You cannot tell a difference between the original and newly created hardlinks to a file. But it is easy to detect a symlink to a file. Just like it is easy to detect a symlink to a folder (AKA directory junction, in Microsoft nomenclature).
Counterintuitively, directory junctions are not the same as directory symlinks. IIRC, the behavior difference is mainly in how they are interpreted from an external machine. See e.g. https://superuser.com/questions/343074/directory-junction-vs-directory-symbolic-link
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Re: copy symlinks as symlinks

Post by *Sir_SiLvA »

So 11 years later is there yet an option to copy file LINKS as LINKS and not as the file the LINK points to?

If not, how do you guys copy file LINKS?
Hoecker sie sind raus!
User avatar
Dalai
Power Member
Power Member
Posts: 9943
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: copy symlinks as symlinks

Post by *Dalai »

2Sir_SiLvA
What type of links to files are you referring to? Hard link or symlink? For the former, please see Ghisler's answer on page 1 of this thread; they're (almost) indistinguishable from regular files, and hard links only work within the same volume.

If you're referring to the latter, please keep in mind that creating symlinks requires administrative privileges, regardless of where they point to and how they're created.

So, if talking about links, please specify the type of link as this is important.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Re: copy symlinks as symlinks

Post by *Sir_SiLvA »

2Dalai

In %Commander_Drive%\aktuelle Projekte\Total Commander\01 - TCUpdater - Tool to Update TC from Installpackage\Version 1.1\tcupdater.exe
I have a tool I wrote myself and in the "file" in %Commander_Path%\Tools\SmallTools\own\tcupdater.exe
is a link created with mklink to the first file.

In the filelist under filesize the "file" shows up as <LINK> so there is a way to differntiate between the file and the link
but when I copy that link with F5 the file is copied instead of the link.

(PS: the link has the attribute faSymLink (Delphi) if that helps)
Hoecker sie sind raus!
User avatar
Dalai
Power Member
Power Member
Posts: 9943
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: copy symlinks as symlinks

Post by *Dalai »

OK, so you're referring to symlinks pointing to files in this case.

Since you asked about how to copy links, here's my answer to that. The implementation in TC is pretty much useless, IMO. It requires the user to change/set CopyLinks setting, copy the files, and change the CopyLinks setting back to its previous value. Who does that? And if I understand it correctly, CopyLinks doesn't even handle symlinks.

Unfortunately, various people - including me - were not successful in convincing Ghisler to add an option to the copy dialog that tells TC how links are to be handled. This needs to be decided on a case-by-case basis.

So, here's what I've been doing:
I copy the files and skip all links; the IgnoreLinks setting can be used for that. Then I search for files and directories that are links (junctions or hard links, I don't use symlinks at all), export them into a text file and recreate them in the target directory structure. Yes, this is quite a lot of work. But it could be automated with a script that reads links and what they're pointing to. And I have such script for directories in %UserProfile% (especially in %AppData%) which point to my data drive.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
tuska
Power Member
Power Member
Posts: 4046
Joined: 2007-05-21, 12:17 UTC

Re: copy symlinks as symlinks

Post by *tuska »

2Sir_SiLvA

Maybe this post will help?
Is it possible to copy file symlinks as links? (Horst.Epp)
Solution with the “Fastcopy” tool (Size: <LNK>).
BUTTON - Copy folders or files using FastCopy (as ADMIN) - <LNK> Symlinks

Code: Select all

TOTALCMD#BAR#DATA
*%COMMANDER_PATH%\Tools\FastCopy\FastCopy.exe
/cmd=update /balloon=FALSE /log=FALSE /auto_close /srcfile_w="%WL" /to="%T"
C:\WINDOWS\System32\shell32.dll,264
Copy folders or files using FastCopy (as ADMIN) || <LNK> Symlinks|https://www.ghisler.ch/board/viewtopic.php?p=429496#p429496|Is it possible to copy file symlinks as links? (Horst.Epp)


-1
Example

C:\Everything\Everything_DRIVE-C\

Code: Select all

Name			Ext	Size	Date			Attr
Filters-DRIVE-C		csv	<LNK>	02.02.2023 15:48	-a--
copied to...
D:\TEMP\

Code: Select all

Name			Ext	Size	Date			Attr
Filters-DRIVE-C		csv	<LNK>	02.02.2023 15:48	-a--
User avatar
AntonyD
Power Member
Power Member
Posts: 1554
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: copy symlinks as symlinks

Post by *AntonyD »

If there is at least some kind of solution - even with the use of third-party programs, this is great!
BUT so far, the main problem is the fact that it has already been voiced above - since Total itself
(as the user would like) does not correctly process such "connections" - then there is a problem
with finding them among the massive of selected files|folders|subfolders.....
In order to then accurately process only them.

OR we need to put the use of such third-party programs on a permanent basis instead of
using the standard copy/move functions that are built into the Total.
So as not to think that some files/links were not processed during the copy/moving process.
#146217 personal license
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6950
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: copy symlinks as symlinks

Post by *Horst.Epp »

tuska wrote: 2025-03-26, 18:16 UTC 2Sir_SiLvA

Maybe this post will help?
Is it possible to copy file symlinks as links? (Horst.Epp)
Solution with the “Fastcopy” tool (Size: <LNK>).
Yes, It's possible with FastCopy.
My parameters for the copy button are
/cmd=Update /balloon=FALSE /log /filelog /auto_close /srcfile_w="%WL" /to="%T"

You have to set the FastCopy options under
Main Settings / Copy Options
x Copy Junction/Symlink as Junction/Symlink

TC must run with enhanced rights for this.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Re: copy symlinks as symlinks

Post by *Sir_SiLvA »

AntonyD wrote: 2025-03-26, 21:11 UTC If there is at least some kind of solution - even with the use of third-party programs, this is great!
BUT so far, the main problem is the fact that it has already been voiced above - since Total itself
(as the user would like) does not correctly process such "connections" - then there is a problem
with finding them among the massive of selected files|folders|subfolders.....
In order to then accurately process only them.

OR we need to put the use of such third-party programs on a permanent basis instead of
using the standard copy/move functions that are built into the Total.
So as not to think that some files/links were not processed during the copy/moving process.
100% agree on this!

2Horst.Epp
Thanks for your input, which helps a lot!
Is FastCopy portable?
Hoecker sie sind raus!
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6950
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: copy symlinks as symlinks

Post by *Horst.Epp »

Sir_SiLvA wrote: 2025-03-27, 17:29 UTC 2Horst.Epp
Thanks for your input, which helps a lot!
Is FastCopy portable?
Yes

I use a batch like this to update it inplace.
FastCopy5.7.15_installer.exe /noprog /nodesk /noapp /extract64 /nosubdir /dir=C:\tools\FastCopy
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Post Reply