Moving files from place to place in Rust

2.7k Views Asked by At

Say I have a file structure like so

a
|
+-- x
|
+-- y
b

and I wish to move x from a to b, what would be the best way of achieving this in Rust? I am working on Windows, but would optimally like to add cross platform support.

I am not particularly experienced with Rust at the moment, and haven't been able to find an answer on the web.

EDIT The cross platform support is unimportant at the moment :)

1

There are 1 best solutions below

0
On BEST ANSWER

Use std::fs::rename() to move a file.