Function junction::delete

source ·
pub fn delete<P: AsRef<Path>>(junction: P) -> Result<()>
Expand description

Deletes a junction reparse point from the specified file or directory.

N.B. Only works on NTFS.

This function delete the junction point only, leaving the target directory and its content as is. It does nothing if the junction point does not exist.

§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)?;
    delete(&junction)
}