Junction copy behaviour

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
kire
Junior Member
Junior Member
Posts: 11
Joined: 2007-12-07, 20:16 UTC

Junction copy behaviour

Post by *kire »

I'm backing up my entire C-drive in Windows 7, and as you may know, the drive contains a ton of "junction" links in the Users folder. Now, TC recognizes these, displays them as <LNK>, and (thankfully) only deletes the link, not the target, when I press Delete. However, while copying, I noticed it doesn't copy the junctions to the new disk but instead copies all their contents, as if they were normal directories. Although I can see why you would want to do this in certain cases, I'd like an option to treat links as links and just make new links on the target disk (even if I have to supply my own "junction" tool; unsurprisingly I have one sitting around :) ).

(edit) I see now there is already a topic on this in Fixed Bugs, so a little elaboration may be necessary.

Windows 7, by default, has a large amount of junctions in the Users\Erik directory. They are needed for windows to operate correctly. For example, there is a junction "Start Menu" that points to "C:\Users\Erik\AppData\Roaming\Microsoft\Windows\Start Menu". It is necessary that such junctions are not turned into directories in the process of backing up data, because if I ever move the backup back to C:, programs will expect that any changes to Start Menu also affect Appdata\Roaming\etc.. The current TC junction behaviour makes this impossible, and has me stare at a Cmd box for half an hour to recreate all junctions.

Also, I have junctions from for example "Music" to my external Music hard disk. It's not my objective to back that up, since the source drive is way too large to begin with, and since it's an entirely different medium I can just unplug that, should my computer catch fire. However, it's infeasible to tell TC, 'copy everything, but not this deeply buried folder'.

In possibly related news, I noticed an entry in the Users folder called "All Users", which dir/a informs me is a <SYMLINKD>. TC's copy of it on my backup drive is a broken folder that always tells me "Access Denied" when I open/delete it, even though I have full permissions. Since I don't know what a symlinkd is, I don't know if this is related or not; if it is: my apologies.

To reproduce: free up a considerate amount of space on another drive. Have Windows 7 Ultimate and TC7.50a, run as Admin. Copy your Users folder to your empty space ([x] Copy ntfs permissions, Options>> 2. Overwrite, [x]Skip, [x] Overwrite).

Image:Steps
Partial result - I didn't wait for the entire operation to finish :) Doubleclicking the selected folder gives "Access denied on file!", even though I'm running as admin.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The next version will allow to skip all junctions when copying with the synchronize dirs tool. Unfortunately I cannot simply copy the junctions, because there target may not exist on the target drive, or may be copied later than the junction itself...
Author of Total Commander
https://www.ghisler.com
kire
Junior Member
Junior Member
Posts: 11
Joined: 2007-12-07, 20:16 UTC

Post by *kire »

Could you make it so that if logging is turned on, a message is put in the log file, so I can use that to quickly find and recreate any missing links?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That was discussed many times. I think TC should give a choice (skip junctions, copy as junction, copy as regular folder) to user since user knows if junction will be valid in target or not.
isidro
Junior Member
Junior Member
Posts: 96
Joined: 2006-03-21, 04:39 UTC
Location: argentina

Post by *isidro »

When copying junctions there should be a multiple choice:
Don't copy them, attemp to redirect them to it's new destination, maybe offer the option to create unexistant folders, and backup mode (copy them with their absolute references).
I really would like an option to backup them within a ZIP/7Z file with maybe a descriptive junction list file for restoring on decompression.

In myi opinion, junctions should be treated as .LNK files by default, they make reference of another location, it doesn't matter if location exist or not, should be copied anyway.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Don't forget that you can search for junctions using plugins search tab: tc.filetype = reparse point. And, you may see junction target using plugins like my NTLinks. Using custom columns you may make list of junctions with their targets.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Agree, and it has been brought up more than once. It is quite annoying to have -- what you thought was a quick copy/paste turn into a disk churning duplication of a whole data drive due to one or two errant junctions.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
ND
Member
Member
Posts: 150
Joined: 2006-04-10, 16:24 UTC
Location: Sibiu, RO

Post by *ND »

ghisler(Author) wrote:The next version will allow to skip all junctions when copying with the synchronize dirs tool.
This sounds like optional behavior, so Ok.
I am using junctions as a solution for sync-ing multiple locations on my computer with a single location equivalent with the content of my USB stick, so I want this feature as it is implemented in the current TC version.
ghisler(Author) wrote:may be copied later than the junction itself...
How about handling the junctions only at the end of the sync? Then it should be possible to detect if the target exists, and ask the user what to do about it (e.g. people may still want to keep links to temporary locations).
aNDreas Bolotă
The truth always carries the ambiguity of the words used to express it. (Frank Herbert, God Emperor of Dune)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This sounds like optional behavior, so Ok
It's already in TC 7.56a, see the help:

SyncIgnoreJunctions=0
0: Also follow junctions (reparse points) to directories when synchronizing
1: Exclude directory junctions from synchronizing
Warning: If a directory with the same name exists on the second side, files in it seem to exist only on that side because the junction on the first side is excluded!
Author of Total Commander
https://www.ghisler.com
isidro
Junior Member
Junior Member
Posts: 96
Joined: 2006-03-21, 04:39 UTC
Location: argentina

Post by *isidro »

So in theory you could add a 2: backup mode, where every junction is stored with it's exact original pointing place (so it's not necessary to check directory existance).
Post Reply