ASP VBScript Details :: Could not delete file
This thread was displayed: 100 times
Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.
For more information about the affected products visit: www.interaktonline.com/Support/
BHANU KIRAN VALASA
02-06-2007 17:37:47 GMT +2
|
Hello Gurus....I am new to ASP and VBScript and struck with the below problem....please help me in solving.
I have ASP Script on a remote server, being invoked from a JSP (Invocation and response every thing works fine).
This ASP verifies whether a file exists on the local hard disk...if not create a file (running.txt) and run a shell script other wise...just return a message.
The shell script runs a batch file which creats a file (current_datetime.txt) and at the end deletes the running.txt and current_datetime.txt.
My problem is, the batch file could not delete the File1 (running.txt)...not sure of the reason. Below is the code what I am trying to execute....
Thanks for your time.
ASP:
<%@ Language = "VBScript" %>
<%
Response.Expires = 0
Response.AddHeader "Pragma","No-Cache"
Dim objFSO, sFile, objFile, strRef, strMesg
Set objFSO = CreateObject("Scripting.FileSystemObject")
sFile = "C:\temp\running.txt"
If objFSO.FileExists(sFile) Then
' CURRENTLY RUNNING SO PROVIDE FEEDBACK
strMesg = "Sorry, a process is currently running, please try later"
Else
' CURRENTLY NOT RUNNING, SO WE CAN RUN
Set objFile = objFSO.CreateTextFile(sFile)
strRef = Request.ServerVariables("HTTP_REFERER")
set wshell = server.createobject("wscript.shell")
wshell.run "C:\projects\Test\test\ContentExtract.bat"
set wshell = nothing
strMesg = "OK, your request is being processed"
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
End If
'Set objFSO = Nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" c>
<META HTTP-EQUIV="Pragma" C>
<META HTTP-EQUIV="Expires" C>
<title>Test</title>
</head>
<body>
<h1>Test Content Extract</h1>
<h1>From <%=strRef%> <%=Request.ServerVariables("REMOTE_HOST") %></h1>
<h1><%=strMesg%></h1>
</body>
</html>
<%
'Set strRef = Nothing
'Set strMesg = Nothing
%>
Batch File:
date /T > c:\temp\current_datetime.txt
echo " "
time /T >> c:\temp\current_datetime.txt
ping www.yahoo.com -n 20
del c:\temp\current_datetime.txt
del c:\temp\running.txt
|
|
|
BHANU KIRAN VALASA
02-06-2007 19:45:40 GMT +2
|
Never mind....I got it.
I gave the proper permissions on the temp folder. It works.
thanks
|
|
|