October 20, 2008 at 7:05 am
Hi All,
I have problems when trying to move a flat file - inside script task , after loading using Dataflow task. I am getting the error -
"The process cannot access the file because it is being used by another process."
The following is the sequence of steps i follow :
1. Using 'Script task' , i check if the file exist . If dont exist , i will wait for specific duration.
2. If file present , i will load the flat file into the table using 'Data flow task'
3. After i load the file , i try to move the file my archieve directory , with date appended to the filename , using 'Script task' .
Following is the code i use inside this 'script task' :
*********************************
V_SRC_LOC = "C:\Data\Data_Dir\4ISR.txt"
V_ARCH_LOC = "C:\Data\Archieve_Dir\4ISR_ARCH.txt"
'To append date to the end of the filename
V_DT = CStr(Day(Now())) & CStr(Month(Now()))
V_ARCH_LOC_NEW = Replace(V_ARCH_LOC, ".", V_DT & ".")
File.Move(V_SRC_LOC, V_ARCH_LOC_NEW)
*********************************
This is the place my 'script task' gives me error -
"The process cannot access the file because it is being used by another process."
Can anyone suggest me to how to overcome this problem???
Thanks,
Arunvijay
October 21, 2008 at 1:35 am
Hi,
do you close the file after reading from it?
You can try to wait for 5 seconds before moving the file, in case the file system needs more time to really close the file.
regards
karl
Best regards
karl
October 21, 2008 at 2:38 am
No. Actually speaking , i really dont know how to close the file.
Can u let me know how to close the file??
Moreover , i dont see any option like File.Close() .
Thanks,
Arunvijay
October 21, 2008 at 5:57 am
hmm...
this is vb-script - don't know if it works for you...
dim fso, file
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set file = fso.CreateTextFile("c:\test.txt", True)
file.WriteLine("Hallo Welt")
file.Close
set file = nothing
set fso = nothing
karl
Best regards
karl
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply