FSO Error

Results 1 to 2 of 2

Thread: FSO Error

  1. #1
    Join Date
    Dec 1969

    Default FSO Error

    Not sure why Im getting this error:<BR><BR>Error Type:<BR>Microsoft VBScript runtime (0x800A01A8)<BR>Object required: &#039;C:Source&#039;<BR>/gripanet/test/BryanLenker/form.asp, line 21<BR><BR><BR>Line 21 is the following:oFileColl = oFolder.Files<BR><BR>I did write out oFolder: C:Source<BR><BR>Here is the the rest of the code:<BR><BR> IF Request.Form("filePrefix") &#060;&#062; "" THEN<BR> Dim fileLocation &#039;As String, <BR> Dim fileDestination &#039;As String, <BR> Dim filePrefix &#039;As String<BR> Dim oFileSystem &#039;As New FileSystemObject<BR> Dim oFolder &#039;As Folder<BR> Dim oCurrentFile &#039;As File<BR> Dim oFileColl &#039;As Files<BR><BR> Set oFileSystem = CreateObject("Scripting.FileSystemObject")<BR> fileLocation = "C:Source\"<BR> fileDestination = "C:Destination"<BR> <BR> filePrefix = Request.Form("filePrefix") <BR><BR> oFolder = oFileSystem.GetFolder(fileLocation)<BR> Response.Write oFolder <BR> oFileColl = oFolder.Files<BR> If oFileColl.Count &#062; 0 Then<BR> For Each oCurrentFile In oFileColl<BR> oFileSystem.CopyFile fileLocation & "\" & oCurrentFile.Name, _<BR> fileDestination & "\" & filePrefix & Right(oCurrentFile.Name, Len(oCurrentFile.Name) - 4)<BR> Next<BR> End If<BR><BR> oFileSystem = Nothing<BR> oFolder = Nothing<BR> oFileColl = Nothing<BR> oCurrentFile = Nothing<BR> END IF

  2. #2
    Join Date
    Dec 1969

    Default RE: FSO Error

    You missed the word "SET":<BR> SET oFolder = oFileSystem.GetFolder(fileLocation)<BR><BR>Without it, oFolder is actually the default property of the folder object, which is probably .Path. Which is why it displays correctly when you response.Write it, but then dies when you attempt to use it as an object.<BR><BR>Same further down - you&#039;ve missed "SET" from there too. Check the place you copied this code from.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts