Is there a crate that has easy shell-like commands?

So I am looking for a crate that feels similar to creating a shell script but I am NOT actually calling any of the shell commands and this crate should be supported for Windows.

For example I can run something like rm -rf directory or something like that.

Does this actually exist?

Is that not just std::fs::remove_dir_all?

that is only to remove directories. WHat I am saying is is there a crate where I can do shell-like scripting such as cp, rm, mv etc?

Whilst the shell scripting capabilities are not platform-agnostic, the basic re-exported function shorthands of ::xshell are.


EDIT: since mv is not included in the above (having a platform-agnostic abstraction of mv is tricky, since within the same filesystem / partition, a simple file rename suffices, and otherwise an "atomic copy and remove original" operation is needed), I'll also mention the ::fs_extra crate.

1 Like
  1. Does it use shell commands at all?

  2. Lets just say I wanted to remove everything recursively and I don't want to delete any files with a specific name (lets call the file name "Rust"). So do you happen to know how I would delete everything but the name "Rust"?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.