Beware: This might be/is a XY-Problem. More of that below.
I'm trying to move a folder from one place to another.
Let's say, I want move from
std::fs::rename does not work accross filesystem boundaries. So I searched for a crate that can do it for me.
I found fs_extra, which is somewhat outdated, but should work. But, it doesn't exactly do what I was hoping. Instead it moves the folder
baz, instead of renaming it.
Is there a way for me to do it?
I have a tar archive which has always a folder (called bar) and I want to unpack it and rename it under its version (e.g 0.54.8). The tar crate doesn't let me remove the top level folder.
I don't want it to place under
/opt/company and then rename it, because of race conditions. That's why I use the tempfile crate to create a temporary directory and then move it.
So I see two options: Either try to extract it directly into the correct directory and strip the top level folder or I need a way to move and rename a folder atomically.