chip_levis


My process checks values in certain files in a "Source" folder against a table in a database. If these values do not match, those files are moved to a "Fail" folder and if they are validated then they are moved to a "Success" folder. My issue is caused by the fact that these files (which are notepad text files) are not being moved over to the success folder for the following error:

"The process cannot access the file '\\Server1\c$\Source\239598.TXT' because it is being used by another process."

I have checked whether these files were actually being used by another process but even cutting off users from the directory and even copied a test file into the folder, the issue will still pop up and for random files.

I've tried using two different components to do the same thing as the "Move" component --- "Copy files from source to destination" and then a separate component "Delete file from Source folder" which is essentially a move. The issue persists on the Delete process because it sees that the file is still being used by some other "imaginary" process it seems to me.

I've tried upping the MaxErrorCount on the Delete and even using the Move components to try to ignore this issue but the package still fails. Are there any other ways to get around this problem




Re: File Move Component Error

DarrenSQLIS


The error is comming straight from the operating system, and seems fair enough. You could engineer a package that re-tried with a loop, but actually I'd be tempted to do that in a Script Task. You would have to decide how long to wait for as well.

Perhaps it would be better to determine the cause of the open file. Add a call to handle and pipe the contents to a log file so you can review when it fails next http://www.microsoft.com/technet/sysinternals/utilities/handle.mspx







Re: File Move Component Error

John Saunders

I once had a maddenning problem with this exeption. It turned out to be caused by a file copy where the source and destination files turned out to be the same file. Is it possible that another file of the same name is already in the destination folder, or is there any possibility that the source and destination folders are the same

[The latter turned out to be my problem. A file was being copied from x:\Attachments to y:\Attachments, and it happened that x == y in one test environment]







Re: File Move Component Error

chip_levis

From what I've worked on, I've haven't had any issues with the source and destination files being named the same. There is an option to overwrite the destination file in your File Transfer component so that usually overcomes this issue. If you set this Overwrite option to True, it should solve this.





Re: File Move Component Error

DarrenSQLIS

Setting Overwrite to true will not solve this. The source file is in use, that is what your errors says. John offered one option as to why it could be "in use", so if that is not your problem, you need to find out what really has it open. Overwrite will allow you to overwrite a closed file, but not one that is still open. From your description it is actually the source file that is still in use, as you said the Delete failed. Using Handle will help identify what process has it open so you can then start to work out why it has.