Could not delete file

Author Message
bvalasa

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 2/6/2007
  • Status: offline
Could not delete file Tuesday, February 06, 2007 3:17 AM (permalink)
0
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" content="text/html; charset=UTF-8">
 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
 <META HTTP-EQUIV="Expires" CONTENT="-1">
 <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

 
#1
    bvalasa

    • Total Posts : 2
    • Scores: 0
    • Reward points : 0
    • Joined: 2/6/2007
    • Status: offline
    RE: Could not delete file Tuesday, February 06, 2007 5:34 AM (permalink)
    0
    Never mind....I got it.
    I gave the proper permissions on the temp folder. It works.
     
    thanks
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9