Dear Ajay Ohri,

Re:

> Dear List,
> 
> Say I can use getwd() and setwd() to change my working directory. How can I
> read in all the files within that directory using command line (like a ls()
> but for the path specified)
> 

I use this function,

#  functions
getFolder <- function(pat)
        {
        txt=file.choose()
        #cat(txt,'\n')
        pos=0
        fname=basename(txt) 
        #cat(paste("\nFilename found is: ",fname,'\n'))
        foln = dirname(txt)
        cat(paste("\nFolder name found is: ",foln,'\n'))
        drtext=dir(foln, pattern=pat, full.names = TRUE)
        #cat('\n\n\n\n') 
        return(drtext)
        }


Best,

Franklin

Dr F. Bretschneider
Dept of Biology
Kruytgebouw W711
Padualaan 8
3584 CH Utrecht
The Netherlands

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to