Sullivan27
New member
- Joined
- Jan 31, 2013
- Messages
- 1
- Programming Experience
- Beginner
I have a simple SQL job that occasionally gets stuck moving files from one folder to another. It executes every 10 minutes, and I assume the entire movement of files only takes a minute or less. Twice last week it got stuck somehow. I was considering adding a while condition on a timer to exit if the movements take longer than 5 minutes such as:
STARTTIME = TIMER
ELAPSED = TIMER - STARTTIME
DO WHILE ELAPSED < 300
' MOVE INSTRUCTION
LOOP
but that will not help me if it is stuck on one particular file, and I really don't need the files to be moved more than once. I am a newbie, and would appreciate all your help. Here is the code:
Function Main()
Main = DTSTaskExecResult_Success
Dim currFolder ,FileName,To_Folder
Dim f, f1, fc
currFolder = "D:\GENERAL_OUTPUT_WIP\"
To_Folder = "D:\GENERAL_OUTPUT\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(currFolder)
Set fc = f.Files
' Check for file and Execute the Move.File Command
For Each f1 In fc
fso.MoveFile "D:\GENERAL_OUTPUT_WIP\*.xml","D:\GENERAL_OUTPUT\"
Next
Set fso = Nothing
Set currFolder = Nothing
Set To_Folder = Nothing
Set f1 = Nothing
Set fc = Nothing
End Function
STARTTIME = TIMER
ELAPSED = TIMER - STARTTIME
DO WHILE ELAPSED < 300
' MOVE INSTRUCTION
LOOP
but that will not help me if it is stuck on one particular file, and I really don't need the files to be moved more than once. I am a newbie, and would appreciate all your help. Here is the code:
Function Main()
Main = DTSTaskExecResult_Success
Dim currFolder ,FileName,To_Folder
Dim f, f1, fc
currFolder = "D:\GENERAL_OUTPUT_WIP\"
To_Folder = "D:\GENERAL_OUTPUT\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(currFolder)
Set fc = f.Files
' Check for file and Execute the Move.File Command
For Each f1 In fc
fso.MoveFile "D:\GENERAL_OUTPUT_WIP\*.xml","D:\GENERAL_OUTPUT\"
Next
Set fso = Nothing
Set currFolder = Nothing
Set To_Folder = Nothing
Set f1 = Nothing
Set fc = Nothing
End Function