Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.4k views
in .NET FTP by (120 points)
I know it was asked in topic 1160, but no outcome came of it. I'm having the same issue:

string l_strFileName = null;
l_strFileName = myFile.Name;
ftpConnection1.DownloadFile(@"c:\temp\" + l_strFileName, l_strFileName);

When it gets to that third line, it fails with an exception message, "The process cannot access the file \"c:\\temp\\myFile.zip\" because it is being used by another process." Looking in the directory, the file is there, but only 4k of it.

The stacktrace is here:
" at System.IO.__Error.WinIOError(Int32 errorCode, String str)\r\n at System.IO.FileInfo.Delete()\r\n at EnterpriseDT.Net.Ftp.FTPClient.GetASCII(String localPath, String remoteFile)\r\n at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile)\r\n at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile)\r\n at Scratch.Form1.btnLoad_Click(Object sender, EventArgs e) in e:\\visual studio projects\\scratch\\form1.cs:line 213"

Line 213 is where the third line of code I mention above is located, I have a bit more logic in the app to pull out only certain files - but looking at what's being sent, it looks right.

3 Answers

0 votes
by (162k points)
Set the DeleteOnFailure property to false.

An error is occurring in the transfer, and subsequently the client tries to clean up the partially downloaded file.

Post a snippet of the logfile so we can take a look at why the original error is occurring.
0 votes
by (140 points)
Try this

ftpConnection1.TransferType = FTPTransferType.BINARY;
ftpConnection1.Connect();

Setting the TransferType to binary may fix the problem.

-S
0 votes
by (1.4k points)
I was having same issues tranferring lots of files after users uploaded multiple/single files via an asp.net page. I run the edtFTP ftp stuff as a windows service. i added a 5 sec thread.sleep before the Get or any file I/O method. No more problems. I figure the asp.net worker process or operating system was taking to long and when I called the Get I got the message.

Categories

...