Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ASP - If text File exists increment +1

Avatar of getzjd
getzjdFlag for United States of America asked on
Web DevelopmentASPWindows Batch
13 Comments1 Solution1660 ViewsLast Modified:
I need a simple ASP function that when executed will write a file to a directory.  If it exists, then increment it +1    .   Right now as you see below I am placing the txt file in two locations.  I would like ONLY the file in the \backup folder to be incremented if it exists.  The file in \  should just be overwrtiten as it is.


Dim cnn
Dim strReturn
Dim objRS

Set cnn = Server.CreateObject("ADODB.Connection")

Set objRS = Server.CreateObject("ADODB.Recordset")

cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\ShopFloorweb\issue\Goodsissue.mdb;Persist Security Info=False"

SQL= "SELECT datestamp, timestamp, po, material, batch, quantity, uom, movtype, employee FROM tbl1"

'Execute select statement
SET objRS = cnn.Execute(SQL)

strReturn= objRS.GetString (2, , vbTab,vbCrLf, "Null")
set objRS = Nothing

dim fs,tfile, zfile
set fs=Server.CreateObject("Scripting.FileSystemObject")
set tfile=fs.CreateTextFile(Server.mapPath("/") & "\issue.txt")
set zfile=fs.CreateTextFile(Server.mapPath("/") & "\backup\issue.txt")
set zfile=nothing
set tfile=nothing
set fs=Nothing

Avatar of Badotz
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answers