TC copies between junction and its target drive on move

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

TC copies between junction and its target drive on move

Post by *MVV »

E.g. I have folder E:\1 and its junction F:\1. So, folder F:\1 is physically on drive E:. If I move files from F:\1 to some folder on drive E: or vice versa, TC does copy+delete instead of just move. Standard copy method is used.

There is a function MoveFileEx that does fast move. Also it supports flag MOVEFILE_COPY_ALLOWED that allows to perform slow move (copy+delete) if source and target are on different volumes.

Tested on TC 8.01x32.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Are you sure that MoveFileEx can really move the files in this special case?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I'm using it in my Virtual Panel, it copies+deletes or simply moves depending on source and target volumes. Also I'm using MoveFileWithProgress (in FsGetFile function) but they both support mentioned flag. I've tried to move file from VP to junction and it works correctly.

AFAIK function GetFileInformationByHandle allows to get volume serial number to check if source file and target folders are within the same volume. But it may be slower for little files so I think it would be enough to check it just for source and target folders (the only exception will be the file symbolic link) if you use other copy modes. But it seems that it is only available since WinXP.
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Volume serial number is not reliable. As far as I remember, It's placed somewhere in the boot record. It's generated randomly during format, but I've also seen computers with serial numbers of all partitions set to 0.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe.

Anyway function GetVolumePathName works 100%, it returns drive letter (or maybe some mount point if no letter assigned) for any path, I've checked it, it returns correct drive letter for a junction. It seems that it also is available only since WinXP.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

TC 8.50b7 still copies+deletes file between dirs within the same volume in case of junctions. It is really easy to use MoveFileWithProgress with MOVEFILE_COPY_ALLOWED. I'm using it in my CopyTree plugin too, and it moves files immediately.

Why do I use junctions? It is simple. I redirected user folders (like Desktop or Documents) to another drive, and when I move e.g. movies from that drive's root to desktop folder (which is on the same drive) TC wastes a lot of time for unnecessary copying data.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry but I find it too risky to use this function. When I read the MSDN description, it seems that it's only supported by certain types of file systems, and it even seems to be platform-dependent:

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.
Technology Supported
Server Message Block (SMB) 3.0 protocol
SMB 3.0 Transparent Failover (TFO)
SMB 3.0 with Scale-out File Shares (SO)
Cluster Shared Volume File System (CsvFS)
Resilient File System (ReFS)

And it's not described that will happen with NTFS, FAT(32) or Samba shares.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think MSDN only tells that listed technologies also support this function. I doubt they will break thousands of Win7 applications that use this function.

Look, they write same text for CopyFile function. :)

I just tried to move files to a network share and between NTFS folders in Win2012 via CopyTree, it moves w/o any problems.
I'm sure it will work with FAT32 too.
Post Reply