Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/FTP/Rust/ftp.rust
Normal file
15
Task/FTP/Rust/ftp.rust
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use std::{error::Error, fs::File, io::copy};
|
||||
use ftp::FtpStream;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut ftp = FtpStream::connect("ftp.easynet.fr:21")?;
|
||||
ftp.login("anonymous", "")?;
|
||||
ftp.cwd("debian")?;
|
||||
for file in ftp.list(None)? {
|
||||
println!("{}", file);
|
||||
}
|
||||
let mut stream = ftp.get("README")?;
|
||||
let mut file = File::create("README")?;
|
||||
copy(&mut stream, &mut file)?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue