Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust create directory

let mut current_dir = env::current_dir().unwrap();
current_dir.push("sub_dir_one");
current_dir.push("sub_dir_two");
create_dir_all(&current_dir).unwrap();

current_dir.push(format!("filename_{}.json", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()));
let mut new_file = File::create(current_dir).unwrap();

new_file.write_all("content").unwrap().as_bytes()).unwrap();
 
PREVIOUS NEXT
Tagged: #rust #create #directory
ADD COMMENT
Topic
Name
8+6 =