Skip to content

Question about Unix file paths

2 messages · Gabor Grothendieck, Duncan Murdoch

#
Perhaps the dir= and pattern= arguments could be combined so that 
its not necessary to for list.files to paste them together:

  list.files("C:/a*.txt", glob=T)

 
Date: Tue, 25 Nov 2003 07:14:49 -0500 
From: Duncan Murdoch <dmurdoch@pair.com>
To: Prof Brian Ripley <ripley@stats.ox.ac.uk> 
Cc: <r-devel@stat.math.ethz.ch> 
Subject: Re: [Rd] Question about Unix file paths
On Tue, 25 Nov 2003 07:35:57 +0000 (GMT), you wrote:

            
This is something that R could not do reliably by itself. The code I
committed checks the final character in the path, and if it's "/", "\"
or ":" doesn't add a path separator. However, both "C:" and "C:\" are
valid directory names in standard Unix file systems, so the test would
do the wrong thing there.

I think people who mount strange file systems will just have to expect
occasional glitches. The only way I can see around this is to add
another argument to list.files() to say whether to add a path
separator, but it would be so rarely used that it doesn't seem to be
worth the effort.

Duncan Murdoch

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
#
On Tue, 25 Nov 2003 07:27:46 -0500 (EST), you wrote:

            
Why not use system() or shell() instead?  Those explicitly do what ls
or dir would do.

Duncan Murdoch