Error when deleting file - check if file still exists

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Error when deleting file - check if file still exists

Post by *MarcinW »

There is an improvement that could be done when deleting files. Steps to reproduce the problem:

1) select some folders and some files with gray *,
2) press F8, but don't start deleting,
3) now launch another instance of TC and delete these folders and files,
4) return to the first instance of TC and press "Yes" to start deleting,
5) now none of folders and files exists, so TC reports errors "The directory XXX is not empty!" or "File XXX not found!".

In real world we can face this problem e.g. when deleting contents of TEMP folder, when some application deletes its own temporary files in the background.

So the improvement is: check if a folder/file still exists, before reporting an error to the user.

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately checking whether a file/folder still exists immediately after deleting it is unreliable. Especially on network drives, we may get a "still exists" reply, because the file is deleted with a delay.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

I wrote about exactly opposite situation - when TC tries to delete file/folder, but can't do this because this file/folder ALREADY DOESN'T EXIST in the moment of deleting by TC (because has been deleted in the background by some other application).

So deleting fails, nevertheless there is no need to display an error dialog - because the user wanted to delete file/folder and it doesn't already exist - so that's what the user wanted. And it has no meaning that the file/folder was deleted by some other application, not the TC itself.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler,
I think DeleteFile function (or GetLastError) returns special error code when file doesn't exist...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I simply noticed that it cannot be determined reliably when deleting on network drives.
Author of Total Commander
https://www.ghisler.com
Post Reply