I, by mistake, have created a new project directory with cargo new communicator --bin, instead of cargo new communicator --lib.
Then, I tried to remove the entire directory with rmdir --ignore-fail-on-non-empty communicator. This command doesn't generate an error in the next line, but when I look to see if it's removed it's still there!
I wonder why I cannot remove a project directory in this fashion.
I tried both on Atom's Terminal Window and MX Linux Xfce Terminal, but the same result... Also, just in case I performed the same rmdir command as a root, but in vain.
Am I fundamentally doing something wrong here?
The flag --ignore-fail-on-non-empty doesn't mean that rmdir goes ahead and removes the directory. It simply silences the error. Instead, you can use rm -r communicator.
Cargo doesn't do anything "special" with the project folder. If you accidentally created a --bin project instead of a library, You can
Delete the communicator bin project with rm -rf communicator where r is for recursive and f is to force remove(in case folder is not empty).
Delete communicator/src/main.rs and create communicator/src/lib.rs.
The second option has the same effect as deleting the --bin project and creating a library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With