Re: Deleting files with ASP
From: JA (jarmour_at_kc.rr.com)
Date: 03/08/04
- Next message: Jerry: "Re: FP Form w/Option Buttons (again)"
- Previous message: JA: "Re: Deleting files with ASP"
- In reply to: JA: "Re: Deleting files with ASP"
- Next in thread: Kevin Spencer: "Re: Deleting files with ASP"
- Reply: Kevin Spencer: "Re: Deleting files with ASP"
- Reply: Jon: "Re: Deleting files with ASP"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 08 Mar 2004 02:39:21 GMT
I sent your posts to the programmer, he said:
I have tried the second parameter a few days ago and it made no difference.
I got the same permission denied problem
Thanks again, Jill
"JA" <jarmour@kc.rr.com> wrote in message
news:hCQ2c.3510$4B1.2158@twister.rdc-kc.rr.com...
> Thanks, both of you, for your replies.
>
> Here is a smaller version of his logic that he made to show what is
> happening. I don't know much about this, but it looks to me like this
script
> is trying to delete the file and then rewrite it. He (the programmer) has
> said that he has tried both overwriting and deleting. I can run this once,
> and the file will be created. If I run it again, I get this error:
>
> __________________________________
>
> Microsoft VBScript runtime error '800a0046'
>
> Permission denied
>
> /folder/testfiles.asp, line 10
>
> ___________________________________
>
> Only if I delete the file manually, I can run it again. Here is the
script:
>
> ____________________________________
>
> <%Response.buffer=TRUE%>
> <!-- #include file="st$db.asp"-->
> <!-- #include file="fileio.asp"-->
> <%
> serverfilename="folder/filetest.txt"
> Set objFS = CreateObject("Scripting.FileSystemObject")
> serverfilename = Server.Mappath(serverfilename)
> If objfs.FileExists(serverfilename) Then
> debugwrite "deleting " & serverfilename
> objfs.deletefile(serverfilename)
> end if
> Set objFile = objFS.CreateTextFile(serverfilename)
> debugwrite "Creating " & serverfilename
> objfile.WriteLine "This is a test line"
> objfile.close
> set objfs=nothing
>
> %>
>
> ___________________________________
>
> I'm going to send him what both of you wrote. If you see something else
> wrong in the script, please let me know.
>
> Thank you!!
>
> Jill
>
>
> "Jon" <js@roksteady.net> wrote in message
> news:uhJ%23%23dKBEHA.1796@TK2MSFTNGP12.phx.gbl...
> > > This depends somewhat on how you're creating the file.
> > > For example, if you're using the
> > > Scipting.FileSystemObject's CreateTextFile method, you
> > > have to specify a second parameter such as
> > >
> > > fso.CreateTextFile("myfile.txt", true)
> > >
> > > if you want to overwrite any existing file. The default
> > > for this method, is false, meaning that the
> > > FileSystemObject won't overwrite existing files.
> >
> > Wrong way around - the default is to over-write unless you specify
false.
> > For example
> > set f=oFso.createtextfile("c:\text.txt")
> > the same as
> > set f=oFso.createtextfile("c:\text.txt",true)
> > would over-write text.txt if it existed. But
> > set f=oFso.createtextfile("c:\text.txt",false)
> > would give a "file exists" error if the file already exists.
> >
> > We would need to see the code (and the exact error message) to be able
to
> > help further.
> >
> > Jon
> > Microsoft MVP - FP
> >
> > Jim Buyens wrote:
> > >> -----Original Message-----
> > >> Hi,
> > >
> > > Howdy.
> > >
> > >> I am using FP 2000 on IIS4/NT. I have an asp script that
> > >> creates some files from a database. It writes from a
> > >> private subfolder ( _folder) to a subfolder of the
> > >> private subfolder ( _folder/folder).
> > >>
> > >> It will work once, but once the files are in there, I
> > >> can't run the script again and overwrite them. I get
> > >> a "permission denied" error. If I go in and manually
> > >> delete the files, it will work again.
> > >>
> > >> Neither the programmer or my ISP can figure out what is
> > >> wrong. The only other thing I can think of is a
> > >> FrontPage quirk.
> > >>
> > >> Does anyone have any ideas on this?
> > >> Thanks, Jill
> > >
> > > This depends somewhat on how you're creating the file.
> > > For example, if you're using the
> > > Scipting.FileSystemObject's CreateTextFile method, you
> > > have to specify a second parameter such as
> > >
> > > fso.CreateTextFile("myfile.txt", true)
> > >
> > > if you want to overwrite any existing file. The default
> > > for this method, is false, meaning that the
> > > FileSystemObject won't overwrite existing files.
> > >
> > > For more information on Scripting.FileSystemObject
> > > methods, browse:
> > >
> > > http://msdn.microsoft.com/library/en-us/script56/html/
> > > fsooriScriptingRun-TimeReference.asp
> > >
> > > If this doesn't point to a solution, please post again to
> > > this thread and include the exact block of code that's
> > > failing.
> > >
> > > Jim Buyens
> > > Microsoft FrontPage MVP
> > > http://www.interlacken.com
> > > Author of:
> > > *----------------------------------------------------
> > >> \---------------------------------------------------
> > >>> Microsoft Office FrontPage 2003 Inside Out
> > >>> ---------------------------------------------------
> > >>> Web Database Development Step by Step .NET Edition
> > >>> Microsoft FrontPage Version 2002 Inside Out
> > >>> Faster Smarter Beginning Programming
> > >>> (All from Microsoft Press)
> > >> /---------------------------------------------------
> > > *----------------------------------------------------
> >
> >
>
>
- Next message: Jerry: "Re: FP Form w/Option Buttons (again)"
- Previous message: JA: "Re: Deleting files with ASP"
- In reply to: JA: "Re: Deleting files with ASP"
- Next in thread: Kevin Spencer: "Re: Deleting files with ASP"
- Reply: Kevin Spencer: "Re: Deleting files with ASP"
- Reply: Jon: "Re: Deleting files with ASP"
- Messages sorted by: [ date ] [ thread ]