Move/rename within junctions perform copy/delete

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
JudgeAxl
Junior Member
Junior Member
Posts: 10
Joined: 2008-04-26, 13:44 UTC

Move/rename within junctions perform copy/delete

Post by *JudgeAxl »

Since I mistakenly put this issue along with another thread specifically about the junctioned folder themselves, here's a proper, enhanced bug report with the correct context.

When moving/renaming files between two panes showing different drives, but where one pane shows a folder junctioned to one on the other drive (i.e. they both actually represent content the same drive) files are copied and deleted instead of simply moved or renamed.

Example:
Create a folder D:\target
Create a junction C:\target -> D:\target
Copy a large file into the folder. (large means you'll be able to measure the time of the operation)
Show C:\target in the left pane and D:\target in the right.
Move the file with a new name (F6) from one side to the other. (Shift-F6 doesn't exhibit the problem)
Result: The file is copied to the new name and the old file is deleted.
Expected: The file should just be renamed since both panes actually show a folder on the same drive.

Cheers
/axl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed Total Commander only moves files within the same drive letter at this time, it's not currently possible to move files between different drive letters pointing to the same partition, sorry. I haven't found a fast way to check this yet.
Author of Total Commander
https://www.ghisler.com
JudgeAxl
Junior Member
Junior Member
Posts: 10
Joined: 2008-04-26, 13:44 UTC

Post by *JudgeAxl »

I see. I'll check some code I've got lying around. If I come up with anything I'll let you know.

Cheers
/axl
JudgeAxl
Junior Member
Junior Member
Posts: 10
Joined: 2008-04-26, 13:44 UTC

Post by *JudgeAxl »

After some quick checking around last night I found a few ways to track down the "real" path of files and folders, but it seems to be available only in Vista or later, so that's of no use. I did however try the above move-operation in Powershell (I'm not allowed to post the link yet, you'll find it if you need it), using Move-Item, and it performed a proper rename although the file was referenced through different drives, so it's possible at least. Filemon gave no indications on what API calls that were involved however, so I'll continue looking.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I assume that it just calls MoveFile(Ex) and hopes that the operating system can decide whether the file can be moved or not. In the worst case with exotic drives, the data would be copied and then deleted within MoveFileEx, without a chance to interrupt it. MoveFileEx supports a parameter MOVEFILE_COPY_ALLOWED, but I don't know how reliable this is with non-Windows drives like Netware or Samba, and how much delay it causes when calling MoveFileEx EVERY time before copying the file...
Author of Total Commander
https://www.ghisler.com
JudgeAxl
Junior Member
Junior Member
Posts: 10
Joined: 2008-04-26, 13:44 UTC

Post by *JudgeAxl »

Ok, that might be it. I don't have any samba or netware drives to try this against, but I'll see if there are any details online.
Post Reply