Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kivimango/57fd669c44307021d29cd16d85bccb09 to your computer and use it in GitHub Desktop.

Select an option

Save kivimango/57fd669c44307021d29cd16d85bccb09 to your computer and use it in GitHub Desktop.
print a formatted lists of files in rust
let files = list_dir(Path::new("."));
match files {
Ok(content) => {
println!("{0: <35} | {1: <10} | {2: <10} | {3: <10}",
"Name", "Extension", "Created", "Size");
for f in content {
println!("{0: <35} | {1: <10} | {2: <10} | {3: <10}", f.name, f.ext, f.date, f.size);
}
}
Err(error) => {
println!("{}", error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment