From ligges at statistik.tu-dortmund.de  Fri Jan 17 11:48:06 2014
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Fri, 17 Jan 2014 11:48:06 +0100
Subject: [Rd] file.exists does not like path names ending in /
In-Reply-To: <CAP01uRmStfL2Kd0AK0KGGkdeUY_Qbde885AfSDy8VNDHbras7g@mail.gmail.com>
References: <CAP01uRmStfL2Kd0AK0KGGkdeUY_Qbde885AfSDy8VNDHbras7g@mail.gmail.com>
Message-ID: <52D90A66.1010501@statistik.tu-dortmund.de>



On 17.01.2014 06:10, Gabor Grothendieck wrote:
> If a path name ends in slash then file.exists says it does not exist.
> I would have expected these to all return TRUE.
>
>> file.exists("/Program Files")
> [1] TRUE
>> file.exists("/Program Files/")
> [1] FALSE
>> file.exists(normalizePath("/Program Files/"))
> [1] FALSE
>> R.version.string
> [1] "R version 3.0.2 Patched (2013-11-25 r64299)"
>
> I am using Windows 8.1 .
>


See ?file.exists:

"(However, directory names must not include a trailing backslash or 
slash on Windows.)"

Note also that  "/Program Files" is not safe anyway since it is relative 
to the current drive.

Best,
Uwe Ligges



[Rd] file.exists does not like path names ending in /
Uwe Ligges