MoveFile problem

Discussion in 'ASP General' started by Patrice, Jan 31, 2005.

  1. Patrice

    Patrice Guest

    Hi,
    I want to move images from a folder to specific subfolders.
    The script below generates the following error:
    a.. Error Type:
    Microsoft VBScript runtime (0x800A01A8)
    Object required:'[undefined]'

    <%
    sub moveImagesToFolder(Folder)
    dim fs,fo,x,text,Foldername,fm,f1
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set fo=fs.GetFolder(Server.MapPath(Folder))
    for each x in fo.files
    text=Len(x.Name)-4
    Foldername=Left(x.Name,text)
    set f1 = fs.GetFile(x)

    '/////here is where the error is targeted: don't know why!////
    set fm=fs.MoveFile(f1,"C:\Inetpub\wwwroot\"&Folder&"\"&Foldername&"\")

    set fm=nothing
    set f1=nothing
    next
    set fs=nothing
    set fo=nothing
    end sub

    %>

    Can someone help?
    Thx
     
    Patrice, Jan 31, 2005
    #1
    1. Advertising

  2. The .MoveFile method doesn't return an object. Also, the first argument is
    to be a file path, not a file object.


    fs.MoveFile path1, path2

    Ray at work

    "Patrice" <> wrote in message
    news:lMqLd.41023$...
    > Hi,
    > I want to move images from a folder to specific subfolders.
    > The script below generates the following error:
    > a.. Error Type:
    > Microsoft VBScript runtime (0x800A01A8)
    > Object required:'[undefined]'
    >
    > <%
    > sub moveImagesToFolder(Folder)
    > dim fs,fo,x,text,Foldername,fm,f1
    > set fs=Server.CreateObject("Scripting.FileSystemObject")
    > set fo=fs.GetFolder(Server.MapPath(Folder))
    > for each x in fo.files
    > text=Len(x.Name)-4
    > Foldername=Left(x.Name,text)
    > set f1 = fs.GetFile(x)
    >
    > '/////here is where the error is targeted: don't know why!////
    > set

    fm=fs.MoveFile(f1,"C:\Inetpub\wwwroot\"&Folder&"\"&Foldername&"\")
    >
    > set fm=nothing
    > set f1=nothing
    > next
    > set fs=nothing
    > set fo=nothing
    > end sub
    >
    > %>
    >
    > Can someone help?
    > Thx
    >
    >
     
    Ray Costanzo [MVP], Jan 31, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    4,001
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,180
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,980
    Merek
    Dec 3, 2003
  4. RSH
    Replies:
    0
    Views:
    1,076
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    558
    Bullschmidt
    May 11, 2004
Loading...

Share This Page