Ticket #11883: readdir-test.rs

File readdir-test.rs, 497 bytes (added by nielx, 10 years ago)
Line 
1use std::old_io::fs;
2use std::old_path::posix;
3use std::os;
4
5fn main() {
6 let mut args = os::args();
7 args.remove(0);
8
9 for argument in args.iter() {
10 println!("{}", argument);
11 let contents = fs::readdir(&posix::Path::new(argument));
12 match contents {
13 Err(why) => panic!("{:?}", why),
14 Ok(v) => {
15 for entry in v.iter() {
16 println!("{}", entry.display());
17 }
18 }
19 }
20 }
21}