none
Help in ASP Script RRS feed

  • Question

  • Hi,

    I am working on DTS-Package and I just want to move/copy of source file
    From:
    F:\Clients (Data Team)\Jihn\Miscellaneous\REPORTS\
    To:
    F:\Clients (Data Team)\Jihn\

    But getting error message of 'Path not found' and 'run time error' Please help and advise.

    My script is:

    '**********************************************************************
    '  Visual Basic ActiveX Script
    '************************************************************************

    Function Main()
     DIM sdate
     Dim sFileName
     Dim sNewFileName
     Dim sSourcePath
     Dim sDestinationPath
     Dim sDestinationPath1
     Dim current_year
     Dim currentmonth
     Dim current_day
     Dim current_month_num


     sFileName   = "JNJ_Retiree_Address_Change_ Report.XLS"
     sSourcePath  = "F:\Clients (Data Team)\Jihn\Miscellaneous\REPORTS\"
     sDestinationPath = "F:\Clients (Data Team)\Jihn\"

                
     'Find Old File Name
     sNewFileName = Left(sFileName, InStr(sFileName, ".")-1)

     'Add Current Date to File Name
     current_date = replace(date(),"/","")
     sNewFileName = sNewFileName & "_" & current_date

     'Add File Extension to New File Name
     sNewFileName = sNewFileName & Right(sFileName, Len(sFileName)-InStr(sFileName, ".") +1)

     ' Get current year
     current_year =   DatePart("yyyy", date())

     ' Get current month
     current_month =   DatePart("m", date())
     current_month_num =   DatePart("m", date())
     
     ' Get current day
     current_day =   DatePart("d", date())


     sDestinationPath = sDestinationPath & current_year & "\" & current_month & "\"

     Set fso = CreateObject ("Scripting.FileSystemObject")
          If fso.FileExists (sSourcePath  & sFileName) Then
                 fso.CopyFile sSourcePath & sFileName, sDestinationPath  & sNewFileName
       '          fso.DeleteFile sSourcePath & sFileName
           End if

    Set oFSO = Nothing
     Set oFolder = Nothing
     Set oFileCollection = Nothing
     Set oFile = Nothing

     Main = DTSTaskExecResult_Success

    End Function

    Tuesday, April 14, 2009 4:13 PM