firstly - it looks like you define orgDir but then your code later refers to indexDir? that being said, I don't think that is relevant.
You could always try upgrading to the latest version and see if the problem goes away (if you're not already). I can't replicate the issue here but we can't guess what version you're running of R. It's always helpful to include What build/operating system etc. Use the following command and copy and paste. into your reply please. R.version One option you've got perhaps is to indexDir into the directory and then try the same commands you've mentioned in your post. another option which might work would be based on these two lines. a1<-file.info(list.files(indexDir)) mydir<-row.names(a1[a1$isdir==TRUE,]) let me know if you can't get it. I don't know why your code doesn't work. -- View this message in context: http://r.789695.n4.nabble.com/list-dir-function-tp4033044p4035093.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.