Uwe, you suggest
So you almost got it, just read ?shell carefully enough:
filenames <- shell("dir D:\\tmp\\*.sasb7dat /b", intern = TRUE)
Unfortunately, this does not work and is why I wrote to Rhelp (OK I used system instead of shell, but I tried shell first); here filenames is assigned character(0) even though the dir output is not empty.
(sure about "intern = TRUE" ?)
Hmmm. It works on WinNT, and I cannot check a DOS based OS like Win98, because we don't have any of those DOS based operating systems in our department.
Believe me I did read ?shell many times before I wrote: but I am reporting that shell does not do what ?shell says it should.
or even better in this case:
filenames <- list.files("d:/tmp", pattern = "sasb7dat")
THANK YOU! I'm always forgetting about file.* and friends. Platform independent too.
Still leaves me asking the bigger question though: how do I capture DOS command output in general?
Or, to come back to Peter's suggestion, the help file ?system tells us:
"... (To use DOS internal commands use paste(Sys.getenv("COMSPEC"),"/c",cmd).)..."
[Peter, we don't need to be experts to read this on Windows -- even with that heatwave in Dortmund ... ;-)]
So we get:
filenames <- system(paste(Sys.getenv("COMSPEC"), "/c", "dir /b"), intern = TRUE)
but that's the same way shell() works, so I woudn't expect this to work when shell() doesn't...
Uwe Ligges
Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: [EMAIL PROTECTED]
web: http://www.synequanon.com
Number of attachments included with this message: 0
This message (and any associated files) is confidential and contains information which may be legally privileged. It is intended for the stated addressee(s) only. Access to this email by anyone else is unauthorised. If you are not the intended addressee, any action taken (or not taken) in reliance on it, or any disclosure or copying of the contents of it is unauthorised and unlawful. If you are not the addressee, please inform the sender immediately and delete the email from your system.
This message and any associated attachments have been checked for viruses using an internationally recognised virus detection process. However, Internet communications cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete. Therefore, we do not accept responsibility for any errors or omissions that are present in this message, or any attachment, that have arisen as a result of e-mail transmission. If verification is required, please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of Syne qua non.
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
