From hb at biostat.ucsf.edu  Thu Nov 29 03:25:21 2012
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Wed, 28 Nov 2012 18:25:21 -0800
Subject: [Rd] Non-recursive way to remove empty directory on Windows?
Message-ID: <CAFDcVCRTbVYWK_nGNSwObCmUzQySoqtPgOwLE5RO1wdzEGdcDQ@mail.gmail.com>

Hi,

file.remove(path) will remove an empty directory "on most Unix
platforms", but not on Windows, cf. help("file.remove").  A workaround
for Windows is then unlink(path, recursive=TRUE).  However, unless
you're really careful and make sure 'path' is not empty, you may
delete more than you wish (even worse, path may contain '..' or
likewise from a list.files(all.names=TRUE) call).  Is there another
*non-recursive* way to delete a single empty directory on Windows
(without turning to system() calls)?

Thanks,

Henrik



[Rd] Non-recursive way to remove empty directory on Windows?
Henrik Bengtsson