[Rd] creates directory that can't be deleted (PR#4246)

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Sep 22 22:55:03 MEST 2003

xiaobao_wang at yahoo.com wrote:

> Full_Name: Xiaobao Wang
> Version: R 1.7.1
> OS: Windows XP
> Submission from: (NULL) (
> accidentally done the following:
> rpt.dir <- paste("c:/report/testR","bestsub",spe="/")
> dir.create(rpt.dir)
> (spe should be sep).  Now the directory "c:/report/testR bestsub " cannot be
> removed.  I tried to remove it from Windows Explorer and got the message box:
> =================================================================
> Error Deleting file or folder:
>    Cannot delete file: Cannot read from source file or disk

Hmmm. Strange. Since nobody else has answered up to now, here's a not
very promising answer:
I've got an unremovable directory now, too. Maybe I can take a closer
look tomorrow how to remove such files/directories on Windows. My first
guess was cygwin might help, but that seems not to be the case. Another
idea is to implement a remove-function in low level in the way the
directory was created (not sure whether that will work). I don't have
any further idea, except for using special tools to work directly on the
file system tables (don't do that!).

I thought Windows denies the creation of files (directories) with names
you cannot access later. From my point of view, this is a Windows bug,
not a bug in R [hence replied to r-devel]. Your report can be regarded
as a wishlist entry for working around the windows bug, so that
dir.create() and friends will report an error when trying to create
not-allowed names (presumably nobody is going to implement it, though).

Uwe Ligges

More information about the R-devel mailing list