#1413 file delete cannot delete nonempty directories on Windows 98

obsolete: 8.3.1
Jon Hilbert

"file delete -force" deletes nonempty directories on Windows NT, but not on Windows 98. The following script demonstrates. im4u is a Windows 98 machine, annas_nt is an NT 4.0 machine

% file mkdir //im4u/c-drive/testdir
% open //im4u/c-drive/testdir/jon w
% close fileabd120
% glob //im4u/c-drive/testdir/*
% file delete //im4u/c-drive/testdir
error deleting "//im4u/c-drive/testdir": permission denied
% file delete -force -- //im4u/c-drive/testdir
error deleting "//im4u/c-drive/testdir": permission denied
% file delete //im4u/c-drive/testdir/jon
% file delete //im4u/c-drive/testdir
% glob //im4u/c-drive/testdir/*
no files matched glob pattern "//im4u/c-drive/testdir/*"
% glob //im4u/c-drive/test*
no files matched glob pattern "//im4u/c-drive/test*"
% file mkdir //annas_nt/c-drive/testdir
% open //annas_nt/c-drive/testdir/jon w
% close fileabe3a0
% file delete //annas_nt/c-drive/testdir
error deleting "//annas_nt/c-drive/testdir": directory not empty
% file delete -force -- //annas_nt/c-drive/testdir
% glob //annas_nt/c-drive/test*
no files matched glob pattern "//annas_nt/c-drive/test*"


  • Donal K. Fellows

    • priority: 5 --> 4
    • labels: 104242 --> 104681
  • Donal K. Fellows

    It obviously depends on something fairly subtle, since the following worked as advertised for me with 8.3.0:
    % cd /windows/temp
    % file mkdir foo
    % cd foo
    % close [open bar w]
    % cd ..
    % list [catch {file delete foo} msg] $msg
    1 {error deleting "foo": directory not empty}
    % list [catch {file delete -force foo} msg] $msg
    0 {}

  • Donal K. Fellows

    • labels: 104681 --> 37. File System
  • Jon Hilbert

    Jon Hilbert - 2001-02-16

    I believe another symptom I have discovered is relevant. The TclpStat() routine returns different results depending on whether it is running on W98 or W2000/NT, depending on what type of pathname is passed to it. Apparently W98 does not perform as expected by TclpStat() if the pathname is the root drive of a volume shared on another machine (e.g. \\server\volume). This causes several parts of the Tcl file command to misbehave, including "file delete" as mentioned in the original bug, and "file isdirectory" and "file mkdir".

    The following simple C program can be used to show the difference. Compile and run it as a console app, passing a filename as a single argument. It returns the results of a FindFirstFile() call and a GetFileAttributes() call on the filename.

    #include <windows.h>
    #include <stdio.h>
    #include <sys/stat.h>

    int main(int argc, char* argv[])
    if (argc>1) {
    DWORD attr = GetFileAttributes(argv[1]);
    printf("flag for directory is %08X",FILE_ATTRIBUTE_DIRECTORY);
    printf("\nattributes from GetFileAttributes(%s) : %08X",argv[1],attr);
    WIN32_FIND_DATA findData;
    HANDLE handle = FindFirstFile(argv[1],&findData);
    if (handle != INVALID_HANDLE_VALUE) {
    printf("\nattributes from FindFirstFile(%s): %08X",argv[1], findData.dwFileAttributes);
    } else {
    printf("\nFindFirstFile(%s) returned: %08X",argv[1],(DWORD)handle);
    return 0;
    printf("usage: %s <filename>",argv[0]);
    return 1;

  • Jon Hilbert

    Jon Hilbert - 2001-02-16

    BTW, the symptom I describe in my Feb-16 comment appears to be directly relevant to the symptom described in bug #119351 as well.

  • Andreas Kupries

    Andreas Kupries - 2001-08-23
    • assigned_to: nobody --> vincentdarley
  • Andreas Kupries

    Andreas Kupries - 2001-08-23

    Logged In: YES

    SF renumbering dance. He refers to #219351.

  • Vince Darley

    Vince Darley - 2001-08-24
    • assigned_to: vincentdarley --> hobbs
  • Vince Darley

    Vince Darley - 2001-08-24

    Logged In: YES

    I don't have Win98 to test on, nor am I familiar with Win32
    guts to be able to resolve this.

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-08-24

    Logged In: YES

    This worked just fine for me testing from a Win98 and WinME
    box to the Win98 share, but on Win2K it does return the
    problem. I'm not sure what the best way to work around
    that would be.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks