[R] Testing for symbolic links

Rolf Turner r.turner at auckland.ac.nz
Tue Mar 24 20:49:24 CET 2009


On 25/03/2009, at 6:29 AM, Gregoire Pau wrote:

> Hello,
>
> How can I test in R whether a file is a symbolic link or not ? I  
> haven't
> found anything relevant in R-help but I may be wrong.
> Thanks !

Since symbolic links are a Unix thing, I assume you are working on a  
system
that is sufficiently Unix-like for the following roll-your-own to work:

cfsl <- function(file) {
# cfsl <--> "check for symbolic link"
xxx <- system(paste("ls -l",file),intern=TRUE)
if(substr(xxx,1,1)=="l") TRUE else FALSE
}

HTH

	cheers,

		Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list