我正在尝试将图像从外部设备复制到网络上的文件夹,但是我的代码存在的问题是它在本地驱动器(c :)中创建了一个文件夹并处理了图像。但我在网络上有此文件夹。它应该只创建一个具有今天日期的文件夹,然后在网络上复制图像。
string _ftpURL = @"00.000.00.0"; //Host URL or address of the SFTP server
//string _ftpURL = @"0.0.0.0";
string _UserName = "root"; //User Name of the SFTP server
string _Password = "3p1"; //Password of the SFTP server
int _Port = 2222; //Port No of the SFTP server (if any)
string _ftpDirectory = "/opt/prassel/data/snap/*.jpg"; //The directory in SFTP server where the files will be uploaded
var LocalDirectory = string.Format("\\ws4.lboro.ac.uk\\SY0-1ticketPhotofolder\\TICKET PHOTO'S\\{0:yyyy-MM-dd}", DateTime.Now);
System.IO.Directory.CreateDirectory(LocalDirectory);
Sftp Connection = new Sftp(_ftpURL, _UserName, _Password);
Connection.Connect(_Port);
Connection.Get(_ftpDirectory, LocalDirectory);
Connection.Close();
远程UNC拍以两个斜杠开头。假设ws4.lboro.ac.uk
服务器名称为:
var LocalDirectory = string.Format("\\\\ws4.lboro.ac.uk\\SY0-1ticketPhotofolder\\TICKET PHOTO'S\\{0:yyyy-MM-dd}", DateTime.Now);
要不就
var LocalDirectory = string.Format(@"\\ws4.lboro.ac.uk\SY0-1ticketPhotofolder\TICKET PHOTO'S\{0:yyyy-MM-dd}", DateTime.Now);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句