Yup! When I skip the FTP portion. Everything works fine.
Main Topics
Browse All TopicsHey Guys,
I have a pretty simple VB.NET script that does the following:
1) Zips up files in a directory
2) Send the Zip file via FTP
3) Archives the Zip file
4) Deletes directory and all files within
The problem I'm have is that when it tries to delete the original files, I get the following error message:
"The process cannot access the file because it is being used by another process"
Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The code looks correct. You could dispose the file stream object, but that should not make a difference as you are closing the stream. I see another problem with your code though. You should fix that, and perhaps the file locking problem goes away also:
You are not using the FileStream.Read method correctly. It returns the number of bytes actually read, which can be less than the bytes requested, so you have to loop until you have read all the data.
Or better yet, just use the nice method in the File class that does it all for you:
Dim buffer As Byte() = File.ReadAllBytes(source)
Business Accounts
Answer for Membership
by: maatthiasPosted on 2008-04-02 at 13:04:49ID: 21266881
Where is this exception thrown? At ext, True)
Directory.Delete(tb_Path.T
??