Home All Groups Group Topic Archive Search About

Problem with MoveFile command in ASP page

Author
11 May 2006 6:14 PM
RSH
I have an ASP page that needs to move a file from one directory to another.
The code is quite simple but I can't seem to get it to work.  I keep getting
a "Download Error: Procedure call or argument is not valid." error when it
hits the movefile part of the code.

What am I missing?


Dim fso = CreateObject("Scripting.FileSystemObject")

strFile1 = "C:\\Inetpub\\wwwroot\\20060118-QuarterlyReports-05112006.rpt"

strFile2 =
"C:\\Inetpub\\wwwroot\\Archive\\20060118-QuarterlyReports-05112006.rpt"

If fso.fileexists(strFile1) Then

fso.MoveFile(strFile1, strFile2)

End If



Thanks!

Ron

Author
11 May 2006 6:30 PM
Mattias Sjögren
Ron,

This isn't an ASP newsgroup but ...


>What am I missing?

Probably that backslash isn't an escape character in Basic so you
don't need to double them in file paths.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
11 May 2006 8:35 PM
Cor Ligthert [MVP]
RSH,

Probably has your ASPNET user (as it should be) no rights to do this in the
general Internet Folders and bellow.

I hope this helps,

Cor

Show quoteHide quote
"RSH" <way_beyond_o***@yahoo.com> schreef in bericht
news:eCecNbSdGHA.4108@TK2MSFTNGP03.phx.gbl...
>I have an ASP page that needs to move a file from one directory to another.
>The code is quite simple but I can't seem to get it to work.  I keep
>getting a "Download Error: Procedure call or argument is not valid." error
>when it hits the movefile part of the code.
>
> What am I missing?
>
>
> Dim fso = CreateObject("Scripting.FileSystemObject")
>
> strFile1 = "C:\\Inetpub\\wwwroot\\20060118-QuarterlyReports-05112006.rpt"
>
> strFile2 =
> "C:\\Inetpub\\wwwroot\\Archive\\20060118-QuarterlyReports-05112006.rpt"
>
> If fso.fileexists(strFile1) Then
>
> fso.MoveFile(strFile1, strFile2)
>
> End If
>
>
>
> Thanks!
>
> Ron
>
>