Expand description
useage of fs module
ⓘ
fn main() {
use doe::*;
use doe::DebugPrint;
use doe::Str;
use std::ops::Deref;
// append data to file
append_data_to_file("demo.txt", "demo".as_bytes().to_vec()).unwrap();
// get all files and folders
walk_dir(".".to_path().deref()).unwrap().dprintln();
// get all folders
walk_dir_get_files(".".to_path().deref()).unwrap().dprintln();
// get all folders
walk_dir_get_folders(".".to_path().deref())
.unwrap()
.dprintln();
//move file the directory to a new directory
move_file(
"/Users/ryanandrew/code/test/t1/demo.zip".to_path().deref(),
"/Users/ryanandrew/code/test/t2/d2.zip".to_path().deref(),
)
.unwrap();
//copy file the directory to a new directory
copy_file(
"/Users/ryanandrew/code/test/t1/demo.zip".to_path().deref(),
"/Users/ryanandrew/code/test/t2/d2.zip".to_path().deref(),
)
.unwrap();
//move all files in the directory to a new directory
move_folder(
"/Users/ryanandrew/code/test/t1".to_path().deref(),
"/Users/ryanandrew/code/test/t2/t1".to_path().deref(),
)
.unwrap();
//copy all files in the directory to a new directory
copy_folder(
"/Users/ryanandrew/code/test/d1".to_path().deref(),
"/Users/ryanandrew/code/test/d2".to_path().deref(),
)
.unwrap();
}
Functions
- append data to file
- copy all file in the directory to a new directory
- Copy all files and directories in the directory to a new directory
- get Home directory
- move all file in the directory to a new directory
- move all files in the directory to a new directory
- get all files and folders
- get all files
- get all folders