Skip to content
Prev 264253 / 398502 Next

Querying the path separator?

Unfortunately, no.  .Platform$file.sep on a windows box is the "/".
For this DOS program it needs to be the "classic" backslash.

Ok, we'll hack this a bit (query the platform and test if it is
windows), but now I'm running into escape character problems.  Given:

files1="*.las"
files1_formatted=file.path(getwd(),files1)
files1_formatted
[1] "X:/pathto/*.las"

I want files1_formatted to read:
"X:\pathto\*.las"

Using:
sub("/","\",files1_formatted)
Doesn't work (in fact, its not a complete statement -- I assume since
its waiting for something to follow the / ).  What's the trick with
this?

--j
On Tue, Jun 28, 2011 at 11:05 PM, Berend Hasselman <bhh at xs4all.nl> wrote: