Private void DownloadFolder (string folderPath, string downloadPath, string folderName)
{
DownloadPath=downloadPath + "\ " + folderName;
+ downloadPath setOPERATE_INFO (" new folder path ");
Directory. CreateDirectory (downloadPath);
String [] FileList=Dir (folderPath);
for (int i=0; I & lt; FileList. Length - 1; I++)
{
String ndownloadPath=downloadPath + "\ " + FileList [I];
SetOPERATE_INFO (" download file path: "+ ndownloadPath);
If (FileList [I] the Contains (". "))
{
SetOPERATE_INFO (" file "+ FileList [I]);
String afolderPath=folderPath + "\ " + FileList [I];
SetOPERATE_INFO (" now the source download location "+ afolderPath);
The string fileName=FileList [I];
OpenDataPort ();//open data port
Cmd_Line="RETR" + afolderPath + CRLF.//copy the file command
BinData=https://bbs.csdn.net/topics/System.Text.Encoding.Default.GetBytes (Cmd_Line. ToCharArray ());
Cmd_Stream. Write (BinData, 0, BinData. Length);//written instructions
GetStatus ();//get the information
//this is a problem I found after the output to the operating information box debugging with
SetOPERATE_INFO (" there is a problem of path "+ ndownloadPath);
//the problem in this
FileStream FSTRM=new FileStream (ndownloadPath, FileMode OpenOrCreate);//used to download a file is written to computer
Byte [] fbytes=new byte [1030].
Int CNT=0;
While ((CNT=Data_Stream. Read (fbytes, 0, 1024)) & gt; 0)//flow data from the network (binary form)
{
FSTRM. Write (fbytes, 0, CNT);//write open file flow
}
FSTRM. Close ();//close the file flow
CloseDataPort ();//close port
Flush_right ();//refresh file list
SetOPERATE_INFO (" successful download file: "+ fileName);
}
The else
{
String newfolderPath=folderPath + "\ " + FileList [I];
DownloadFolder (newfolderPath downloadPath, FileList [I]);
SetOPERATE_INFO (" folder "+ FileList [I]);
}
}
return;
}
This is to run the function interface after
The path of the wrong statements output operation information bar at the bottom right, is very strange, clearly the path of the output no illegal character ah...
CodePudding user response:
Path before the spaceCodePudding user response: