I currently use the ftp crate to clone a directory from a location on an ftp server. The ftp crate has options for getting a directory listing so I created a recursive function to scan through all directories. This appears to work well, but I am wondering if it is possible to use the walkdir crate to do this instead?
I have tested walkdir on my local filesystem and it works great but I am wondering if there is someway to use it with an instance of an ftp client? I suspect that this is not possible (since walkdir seems to expect a path reference) but I thought I would ask to see if anyone has any ideas. Below are some snippets for how I am using the ftp crate.
Thanks.
let mut client = FtpStream::connect(&address)?;
client.login("user", "pass")?;
//change to remote directory
client.cwd(&remote_directory)?;
//get list of directories and files as a vector
let contents = client.list(Some("./"))?;
walkdir is tightly coupled with platform specific syscalls for obtaining directory listings. It is not a generic library that lets those things be pluggable, so I don't think what you want to do is possible, if I'm understanding you correctly. (I'm not 100% sure that I am.)
I was basically looking to use WalkDir to recursively list the contents of a location on an ftp server. I had an intuition that it would not be possible but thought I'd ask.
I have implemented a solution myself using a simple recursive function that gets the directory/file listings of the current working directory on the ftp server and drills into each sub directory etc. but was wondering if I could use walkdir for this, instead of reinventing the wheel.