Skip to main content

move_to_trash

Function move_to_trash 

Source
pub fn move_to_trash(path: impl AsRef<Path>) -> Result<PathBuf>
Expand description

Moves path (a file or a folder) to the Trash of its volume, as the Finder’s Move to Trash does, and returns where it is now: keep it to put the item back (undo) with std::fs::rename to the old path. The name in the Trash can differ from the old one when the Trash already has an item with that name.