1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Files disappear in Explorer when DEL fails

Discussion in 'Support' started by vefatica, Aug 25, 2013.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,955
    Likes Received:
    30
    I gave the command "del *.txt" in my temp folder and got
    Code:
    del *.txt
    Deleting T:\FXSAPIDebugLogFile.txt
    TCC: (Sys) The process cannot access the file because it is being used by another process.
    "T:\FXSAPIDebugLogFile.txt"
    Deleting T:\FXSTIFFDebugLogFile.txt
    TCC: (Sys) The process cannot access the file because it is being used by another process.
    "T:\FXSTIFFDebugLogFile.txt"
        0 files deleted      2 failed
    I was watching an Explorer window and they disappeared. They weren't really deleted because a refresh (F5) of the Explorer window brought them back.

    When I try it with CMD I get the same error messages and the files DO NOT disappear from the Explorer window! Likewise with TCSH and PowerShell ... error messages and the files DO NOT disappear from the Explorer window.

    Is there any speculation why they disappear with TCC and not with other shells?
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,860
    Likes Received:
    83
    TCC uses the shell SHFileOperation API; CMD uses the DeleteFile API. You've got a redirector bug.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,955
    Likes Received:
    30
    My bug or everyone's bug?
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,955
    Likes Received:
    30
    Hmmm! It doesn't happen when I do this (below). I get the expected "32" (file in use) and the file does not disappear from the Explorer window. Can you give me more information? I'd like to reproduce this one.
    Code:
    INT wmain ( INT argc, LPWSTR *argv )
    {
        SHFILEOPSTRUCT fos = {NULL, FO_DELETE, L"t:\\FXSAPIDebugLogFile.txt\0", NULL, FOF_NO_UI, 0};
        wprintf(L"%d\n", SHFileOperation(&fos));
        return 0;
    }
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,860
    Likes Received:
    83
    TCC is using different arguments.

    Try it with _wremove() and DeleteFile() and see if it behaves the same way.

    (I am not able to reproduce it here with Windows 8.)
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,955
    Likes Received:
    30
    I cannot reproduce the odd behavior at all with a test app ... not with SHFileOperation (as above), not with _wremove, not with DeleteFile. In a test app all three give the appropriate access/in_use error and the file does not disappear from the Explorer window.

    You said TCC uses SHFileOperation. What args do you use?

    But I am having a difficulty with SHFileOperation that I don't understand and can't get rid of. With the code I posted (plus a couple of printf/GetTickCounts) I see a (nearly exactly) 1 second delay during the execution of SHFileOperation. If the file can be (and is) deleted, there's no delay.

    In a little bit of experimenting, all I've said above remains the same if I try SHFileOperation in a plugin (specifying the console window with all else the same).

    So I still have two questions. Why does doing it with TCC cause the file to disappear from an Explorer window and why do get a 1 second delay from SGFileOperation?
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,955
    Likes Received:
    30
    FWIW, the same odd behavior (files not deleted disappearing from an Explorer window) also happens with v14 and does not happen with v13, v12, or v11.
    And it happens when TCC is started with /IP /II /IS.
     

Share This Page