Page 1 of 1

Error when deleting file - check if file still exists

Posted: 2013-10-13, 19:16 UTC
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

Posted: 2013-10-14, 13:53 UTC
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.

Posted: 2013-10-14, 22:54 UTC
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.

Posted: 2013-10-15, 06:10 UTC
by MVV
ghisler,
I think DeleteFile function (or GetLastError) returns special error code when file doesn't exist...

Posted: 2013-10-16, 14:45 UTC
by ghisler(Author)
I simply noticed that it cannot be determined reliably when deleting on network drives.