[][src]Function trash::remove

pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error>
👎 Deprecated since 1.2.0:

Use the delete function instead. Be careful with differences in symbolic link resolution.

Removes a single file or directory.

Warning: when a symbolic link is provided to this function the link target will be removed and the link will become dangling. That is if 'sl' refers to 'my-text-file' and remove("sl") is called then 'my-text-file' will be removed and 'sl' will be left dangling.

Example

#![allow(deprecated)]
use std::fs::File;
use trash::remove;
File::create("remove_me").unwrap();
trash::remove("remove_me").unwrap();
assert!(File::open("remove_me").is_err());