用ftpsupport建立所有ftp服务器上不存在的目录
最近项目中用ftpsupport.dll进行ftp上传,当用户上传文件时如果目录不存在则建立该目录,但是现在的问题是用户传来的目录有几层都是不存在的,这样就需要循环建立所有不存在的目录,
比如需要上传文件到目录/vagerent/temp/a1/a2,但是/temp/a1/a2三个目录都没有建立。
方法如下:
/**////
/// 检测ftp上是否有该目录,如果没有则建立
///
///
///
///
/// 形如/ftproot/dir2/dir2_2/dirlast
///
private void FtpMakeAllDir(string ip,string name,string psw,string dr)
{
FtpConnection ftp = new FtpConnection();
ftp.Connect(ip,name,psw);
string [] dir = dr.Split('/');
string curDir = "/";
for (int i = 0;i
页:
[1]