Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in .NET FTP by
Hi,

I start downloading a file named "ID.txt" using the command

Get("c:\\downloads\\ID.txt","ID.txt");

I cancel the download of the file as soon as it begins, so the file "ID.txt" contains 0 bytes but is already created on my local drive.

Next I quit the FTP session, then I attempt to delete the ID.txt file of size 0Kb. I get the following exception thrown:

The process cannot access the file "ID.txt" because it is being used by another process.

In fact, I can not do anything to the file ID.txt until I exit my FTP application.

I am using ver 1.1.5

Thank you in advance to anyone who can help me out with this problem.

Tomas

1 Answer

0 votes
by
I was able to to delete the file by forcing garabge collection right after quitting the ftp session.

In case anyone else is having the same problem, it looks like this:

Globals.Ftp.Quit();

GC.Collect();
GC.WaitForPendingFinalizers();

Directory.Delete("blabla",true);


Hi,

I start downloading a file named "ID.txt" using the command

Get("c:\\downloads\\ID.txt","ID.txt");

I cancel the download of the file as soon as it begins, so the file "ID.txt" contains 0 bytes but is already created on my local drive.

Next I quit the FTP session, then I attempt to delete the ID.txt file of size 0Kb. I get the following exception thrown:

The process cannot access the file "ID.txt" because it is being used by another process.

In fact, I can not do anything to the file ID.txt until I exit my FTP application.

I am using ver 1.1.5

Thank you in advance to anyone who can help me out with this problem.

Tomas

Categories

...