Error in VB script used in SISS package ??

  • Hi

    I'm using the followinf script in a ActiveX script task in my SISS package...I get the following error when parsing my script :    

    Object required : 'Server' ..this error occures for the line of code you see in BOLD below.....how can I use this script without getting this error ?? Can I use any other component to make it work. I'm trying to find the last modified date of all files in a specific folder.....greatful for hints

    br//Helmut

    Dim fso

    Dim fld

    Dim fil

    Dim fillastmodified

    Dim datelastmodified

    Dim ts

    Set fso = Server.CreateObject("Scripting.fileSystemObject")

    'find last modified file in a directory

    'Get folder

    Set fld = fso.Getfolder(Server.MapPath(strfolderUrl))

    'walk through files in folder looking

    'for last modified file, remember it

    'when it is found

    datelastmodified = #1/1/100#

    For Each fil in fld.files

    If fil.Datelastmodified > datelastmodified Then

    Set fillastmodified = fil

    datelastmodified = fil.Datelastmodified

    End If

    Next

    If Not (fillastmodified Is Nothing) Then

    'read the remembered file's contents

    'to the return value of the function

    Set ts = fillastmodified.OpenAsTextStream()

    findlastfile = ts.ReadAll()

    Call ts.Close()

    Set ts = Nothing

    Else

    findlastfile = ""

    End If

    Set fil = Nothing

    Set fld = Nothing

    Set fso = Nothing

  • try

     

    Set fso = CreateObject("Scripting.fileSystemObject")

     

    and see if it works any better I don't think you need to reference the Server

     

    S

  • Why dont you use system.io for file operations? 

    try Imports System.io and manipulate file operations.

    -Ashok

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply