FtpConnection ftp = new FtpConnection(serverip, ftpuser, ftppassword); ftp.Open(); ftp.Login(); ftp.SetCurrentDirectory("domain/wwwroot");
void CreateDirOnFtp(string sDir, FtpConnection ftp) { try { foreach (string f in Directory.GetFiles(sDir)) { Uri uri = new Uri(f); ftp.PutFile(f, System.IO.Path.GetFileName(uri.LocalPath)); } foreach (string d in Directory.GetDirectories(sDir)) { string dirname = new DirectoryInfo(d).Name; if (!ftp.DirectoryExists(dirname)) { ftp.CreateDirectory(dirname); } ftp.SetCurrentDirectory(dirname); CreateDirOnFtp(d, ftp); } } catch (System.Exception e) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)