Function junction::create

source ·
pub fn create<P, Q>(target: P, junction: Q) -> Result<()>
where P: AsRef<Path>, Q: AsRef<Path>,
Expand description

Creates a junction point from the specified directory to the specified target directory.

N.B. Only works on NTFS.

§Error

This function may error if the junction path already exists.

§Example

use std::io;
use std::path::Path;
fn main() -> io::Result<()> {
    let tmpdir = tempfile::tempdir()?;
    let target = tmpdir.path().join("target");
    let junction = tmpdir.path().join("junction");
    create(&target, &junction)
}