Answers for "rust get file directory"

3

rust get current directory

std::env::current_dir()?;
Posted by: Guest on October-18-2020
0

rust current directory list files

use std::fs;

fn main() {
    let paths = fs::read_dir("./").unwrap();

    for path in paths {
        println!("Name: {}", path.unwrap().path().display())
    }
}
Posted by: Guest on July-27-2021

Browse Popular Code Answers by Language