Save zip file from ftp



I’m trying to move the bash script to rust, for training.

Now my bash script allows me to:

  1. go to ftp_remote1
  2. go to the directory
  3. keep all the * .zip files on local machine
  4. all the saved files to be moved to done folder (ftp_remote1)
  5. move the files from the local machine to ftp_remote2

How, use Rust, to validate the file, example unzip -t?

P.S. I use


(I would not recommend Rust for something that can be so easily handled in shell, but you say you’re doing this for practice so that’s OK.)

It sounds like you already know one way to verify zip files, which is unzip -t. You could use std::process::Command to use unzip from rust.

You could also try using a Rust library, which would likely be more ergonomic than a shell command. has a search function; IME it doesn’t do ranking or phrase search very well, so it’s less useful with common words, but “zip file” gives a small enough resultset to be useful. That gives one relevant result, unfortunately, it doesn’t support testing. Bummer.

You could use that crate to “extract” the zip file while ignoring the actual data (NOT writing it to files). That’s essentially what unzip -t does; it might be easy enough to implement. But it depends on the crate actually verifying checksums of extracted data; with the current Rust ecosystem I would advise against assuming anything quality-of-implementation related unless it’s documented or you can verify it yourself (either via input-output tests or code auditing, if you feel able to do so). If you can do so and it works, it’d probably be good to submit a documentation pull request for the next person, or even adding a verify function.

Your best bet might be to use unzip -t after all.


Yes, I do it for the experience.
Thanks for the detailed response - I focus on call unzip -t