Indirect rmdir fails

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Karlo
Junior Member
Junior Member
Posts: 2
Joined: 2012-05-26, 09:19 UTC

Indirect rmdir fails

Post by *Karlo »

When I rightclick on a directory and select a self-written program that deletes it, the delete fails from TC 8.0, but not from Windows (XP) Explorer. That feels like a bug in TC.

The above is a simplified example of the problem of course, I do not just want to delete a directory.

To reproduce the problem:
With the registry editor create these keys and standard values:
HKEY_CLASSES_ROOT\Directory\shell\DelDir, Default value=Deldir
HKEY_CLASSES_ROOT\Directory\shell\DelDir\command, Default value=D:\DelDir.cmd "%1"
Create the file D:\DelDir.cmd containing:
rmdir %1 %2 %3 %4 %5 %6 %7 %8 %9
pause
With TC create some dummy directory and try to delete it by rightclicking on it and selecting DelDir: a command-window opens in which the following error-message can be read (translated from Dutch, so might not be exact): "The process has no access to the file because the file is being used by another process."

The Unlocker tool says that only cmd.exe is keeping the file locked.

But the same action (and thus the same "cmd.exe") works just fine when initiated from rightclicking to DelDir from Windows Explorer.
Therefore it feels like a TC bug.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The Unlocker tool says that only cmd.exe is keeping the file locked.
Sounds like the directory you are trying to delete is the current directory in that cmd script. Try to put a
cd ..
command at the beginning of the script.
Author of Total Commander
https://www.ghisler.com
Karlo
Junior Member
Junior Member
Posts: 2
Joined: 2012-05-26, 09:19 UTC

Post by *Karlo »

Problem solved. Difference understood.

When starting a process from the rightclick-menu, Windows always makes the parent-directory of the rightclicked object the current directory of the process, but TC makes it the rightclicked directory.

That is a design-choice, not a bug.

Thanks.
User avatar
white
Power Member
Power Member
Posts: 5807
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Karlo wrote:That is a design-choice, not a bug.
Is it a deliberate design choice?
Post Reply