ftp-cmd-list-parse
This is a Rust library that can parse strings that FTP servers return by LIST
command request.
- Unix-style:
drwxr-xr-x 10 root root 4096 Dec 21 2012 usr
brw-rw---- 1 root disk 8, 0 Nov 24 10:13 sda
-rw-rw-rw- 1 owner 1234 7045120 Sep 02 2012 music.mp3
lrwxrwxrwx 1 root root 51 Apr 4 23:57 www.nodeftp.github -> /etc/nginx/sites-available/www.nodeftp.github
- Msdos-style:
08-22-2018 02:05PM <DIR> wwwroot
08-22-18 12:59PM 99710 logo.jpg
08-22-18 03:01AM 99710 music.mp3
Examples:
use FtpEntry;
let ftp_response: &'static str = "drwxr-xr-x 10 root root 4096 Dec 21 2012 usr";
if let Some = new
You need convert FtpEntry
to FtpEntryUnix
to see additional fields that MSDOS FTP server doesn't support:
use TryFrom; // also you can create `FtpEntry` by use `TryFrom` or `TryInto` traits.
use FtpEntry;
let ftp_response: &'static str = "drwxr-xr-x 10 root root 4096 Dec 21 2012 usr";
if let Ok = try_from
If you ensure what type of FTP server using, you can create FtpEntryUnix
or FtpEntryMsdos
struct directly:
use FtpEntryUnix;
let ftp_response: &'static str = "drwxr-xr-x 10 root root 4096 Dec 21 2012 usr";
if let Some = new