Module :: fs_tools
Tools to manipulate files.
Features
- TempDir: Temporary directory management with RAII cleanup
full_path()- Compose path from base/prefix/postfix componentscreate()- Create directory (parent must exist)create_all()- Create directory with all parents- Automatic cleanup on drop for created directories
- glob (optional): Unix shell-style pattern matching via re-export
Basic Usage
TempDir with RAII Cleanup
use TempDir;
use PathBuf;
let mut temp = new;
temp.base_path = temp_dir;
temp.prefix_path = from;
temp.postfix_path = from;
// Create directory (enables automatic cleanup)
let path = temp.create_all.expect;
assert!;
// Directory is automatically removed when `temp` goes out of scope
Glob Pattern Matching
use glob;
// Find all Rust files in current directory
for entry in glob.expect
Recursive Glob
use glob;
// Find all Rust files recursively
for entry in glob.expect
Pattern Matching
use Pattern;
let pattern = new.expect;
assert!;
assert!;
To add to your project
# Basic (TempDir only)
# With glob support
# All features
Try out from the repository