Delete Line From Text File
if I had a form using the input textboxes using username and password. how do I use the .asp language to remove the line from a .txt using the following format:
username<space>password
if I had a form using the input textboxes using username and password. how do I use the .asp language to remove the line from a .txt using the following format:
username<space>password
I have an Access DB with newsletter preferences in it. What I am trying to do is select small groups to send a custom newsletter out to. So my localhost criteria web page goes to the Access DB and pulls the email addresses that match my current criteria. I then write that list out to a file (newsletterlist.txt). Maybe that is my problem, but I wanted to do that so if my machine crashed while processing, I would know where to recover it. I had looked at arrays and dictionaries but dictionaries aren't good from what I found for hundreds of entries and arrays I can't keep track of..argh.
Anyways, I then wanted to loop through the file (newsletter.txt) find the next email address, with it I can query back to the DB and get preferences and assemble the email and out the custom newsletter goes.
I've seen where MS says deleting a line using the FileSystemObject is not possible, though wanted to see if anyone has found a work around.
Performance isn't that much of an issue for me, as I figured I'd set the thing to running and go to dinner! So anyone have suggestions - even if it means taking the text info to an array, somehow delete one of the addresses and then put it back to a file...anything that can one by one delete the addresses so I know that it all has worked as there would be no email addresses left in the file.
I have a text file named "enterintro.bat". The contents of the file are:
@ECHO OFF
start /w C:skAppActivate.vbs "F4 Event and Entity"
start /w Sleep.vbs 2
start /w C:skSendKeys.vbs "BEC201_IPA{TAB}IPA_SS{ENTER}^S"
What I'm trying to do is to be able to swap out the "BEC201_IPA" and "IPA SS" with different variables. The format of the text file should never change except for swapping out these values. I've used the OpenTextFile method before, but only to append lines to a file, and never to replace an existing line, and I'm not sure how to do it. The best I've come up with so far is this: Code:
ive set the permissions to the folder which the text file is in to 'Write' and 'Read', but i still continue to get:
[/CODE]
Microsoft VBScript runtime error '800a0046'
Permission denied
/modules/admin/program.asp, line 197
[/CODE]
all the path leading to the file is set to allow write aswell.... any ideas why this might be happening?
After looking all over the place and finding codes in vb and in php I even had asked several people on other boards but none of them knew how to do it I say the best way to learn this .asp .aspx junk is to DO IT yourself although Ive scripted in the past with the mIRC client which is why I know programming and html but if anyone is looking for the code this is how its done Code:
View Replies View RelatedI have a log file from my email software program. Each entry is on a line and the values are seperated by tabs. How can I read through this text file such that I insert its contents into a database? Thanks. Tom
Here is one entry from that file:
11/30/06 00:00:21SMTP-IN25AA24076F2041D7B35E97EE7748D06C.MAI65284.244.91.208EHLOEHLO [84.244.91.208]250-home [84.244.91.208], this server offers 4 extensions11922
Sample:
sql="select * from table order by id"
How do I look at the query statement and remove all the characters starting with "order by" and remove all remaining characters in that line?
I have an encrypted .txt file created by asp. Its formatted with lines etc. Title followed by description underneath. I need to read this into ASP now, and parse it line by line. On each line read, run the function to unencrpt and add line to a new file.
Its the line by line Im having trouble with. If i do the full textstream no formatting takes place coz im adding the fulltextstream all in one addline call. How can I loop through lines ?
Meaning files with a .asp file extension, not a .txt file extension. Can this be done?
View Replies View RelatedI'm trying to find the line number of a specific piece of text:
do while textFileOpen.AtEndOfStream=false
if textFileOpen.ReadLine=text2Find then
foundAt=textFileOpen.Line
end if
Loop
But it keeps giving the wrong line number
What I'd like is foundAt to be 0 then if the line is found foundAt is to be the line number, if it is not found stay at 0
In the script above foundAt at increments even though the text isn't in the line?
I also get a "Input past end of file" if text2find isn't found
If I have a long text which I copied from a Word document and pasted it into
asp in order to output it into HTML, how do I detect new line in the text
and insert Line Feed Carriage Return?
ASPError object gives the current line where error occurred. Is there a way to find out the line where Err.Number became non-zero due to a Server.CreateObject(...) failure?
View Replies View RelatedHow can I delete a file which is saved in a folder when the user checked on the checkbox of the file to be removed and click on the Delete button?
View Replies View RelatedI'm trying to delete a file where the path and file and filename are both stored in the database.
ImageData = images/full/group.jpg
How do i go about doing this. I know how to do it for just the file name and when the path is defined on the page.
I am writing one line and for a reason I ignore it adds a line which is screwing up a few things.
<%
Set fso = CreateObject("Scripting.FileSystemObject")
dim sLine sArchivo="switch.txt"
path = Server.MapPath("../Flash")
sFile = path & "" & sArchivo
if fso.FileExists(sFile) then
fso.DeleteFile(sFile)
end if
Set a = fso.CreateTextFile(sFile, True)
if request("radiobutton") = 1 then
sLine = "&ver=si"
else
sLine = "&ver=no"
end if
a.WriteLine (sLine)
a.Close
sRedirect="admin_NoticiasListado.asp?sRadio=" & request("radiobutton")
Response.Redirect(sRedirect)
%>
How come does the extra line come ? I seems I have done already a fews times and it never ocurred before.
is it possible to include a line of asp in a .html file?
View Replies View RelatedI am trying to delete a file off a server (same server asp app is running on). I have done this before and not encountered any problems.
The code I am using is:
Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("......sectionsezineeditionsimagesarticlethu mbs")
ImagePath = ImagePath & "" &
(RS_Content.Fields.Item("CON_Issue_Number").Value) & "" &
(RS_Content.Fields.Item("CON_Image").Value)
However, I am getting an error pointing to the last line of code above:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
I'm sure I am missing something simple from staring at this so long.
HI can any body give me a program for delete a online file in asp.
Actually I have created a program for mail attachment. For attaching
the file first of all I have to upload the file in a directory but
after sending attach file the file should be remove from directory.
I need to delete files across the network using web client (IE 6.x) in Win 2003 - IIS 6.0 environment.suggest an approach I can use to acheive this.Will using FSO do the job or I have to go COM way.
View Replies View Relatedwhat r things that I have to do to let the client browser to delete a file on the server. I'm running my server on WIN2000 pro, IIS 5.0. I've stored my website and server in a virtual directory. This is the code i use to delete a file from the server folder
Code:
Function delete_file(exceldb)
'***************** Delete**********************
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile(Server.MapPath("..upload2uploads"& exceldb))
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
' Deletes exceldb
End Function
I want to know how to delete a file from a folder in ASp Like i have the path of the file at runtime in my ASp file... but how to delete ?
View Replies View Relatedi wrote this code to read the datas from excel(.csv file). but it read all the datas as 1 line. i don't undestand why.is there any function that i can use to stop it read the datas in the next line?? can anyone help me?? thanks a lot.
Do While Not TextStream.AtEndOfStream
line = TextStream.readline
if line <> "" then
arr_User(i) = trim(line)
splitline = split(arr_User(i), ",")
for j=0 to 5
response.Write splitline(j) &"nbsp;nbsp;"
next
i = i + 1
redim preserve arr_User(i)
end if
Loop
I am generating a huge CSV file. It is to large to open in notepad.
Can I use the Filesystem Scripting Object to read the very last line of the
file and delete the very last character?
I am hoping the DSO will not have to read thru the whole file. it is probably way to big.
What is the easiest way to 1) delete a File System Website Solution and 2) rename a File System Website solution?
I noticed when I create the ASP.NET Web Site (via File System location option) that I get one directly with my code (.aspx etc files). but the solution is under the default Visual Studio directory. So I assume if I delete these two directories then my solution is really gone?
Renaming a solution seems to be a bit more tricky - what would be the easiest way to rename the solution and the associated directory with the acutal code (.aspx etc files)?
We have offer a web space to hosting our client website. We offer them to upload asp files to their web space. How can I prevent the client from uploading asp files that will harm our web server.
For example, deleting files in our server using Scripting.FileSystemObject to delete our systemmfiles.
Ok, the following page uploads files to the server and renames them according to the item ID and database table (or update type). It also replaces existing files. There are potentially 5 files for each item ID (see FILE REFERENCE). Code:
View Replies View RelatedI have the setup working close to what I am after. The upload script I am using has been supplied by 'Lewis Moten'.
Basically what I am after is.
A job application contact form. that includes a input="file" element allowing the user to send a CV, to the address related to that job.
So far locally I have the file uploading, the file sent, and then the file deleted all working fine. Althoug this may well work locally I feel I will have problems when I come to trying this live. Mainly due to timings.
Surely the script would need to know when the file has been uploaded completely, also when the file has been sent completely before delete....
What's wrong with this code? Thie file is there, why cant it find it?
<%
myfile = request.querystring("filename")
response write myfile
myFSO.DeleteFile(Server.MapPath(" & myfile & "))
SET myFSO = NOTHING
%>
OUTPUT:
data/000000/index.htm
Microsoft VBScript runtime error '800a0035'
File not found
/deletefile.asp, line 9
Is it possible to delete a file on a client side machine using VB/JAVA script?
My website allows the user to upload a file to the website and after that I would like to delete the file on their machine tried this:
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile("C:1-1-S.xml")
But it is always looking to the server machine? How do I say delete file XYZ on client machine. Is this even possible with the security issues?
I had created a macro to read data from an excel sheet and write the values to a text file. I had used "ActiveSheet.Range("GB" & k).Value" command to read the values from the excel.some cells in the excel sheet is having two lines value and four lines data, the text file is generating that value in a single line. (Ex. the cell value in address column is in four lines and should display in four lines in the text file generated from the macro)
Can i do something in the excel sheet or in vb script to read the address value line by line and write line by line in text file?
i'm converting an image file to hexa..then the hexa is saved to a text file..
can any one help me how to read the content text of a text file?...
im doing it this way because i don't want to save hexa in my database, because it makes the database slower to open up.
Does anyone know of a method of converting text files to sound files (.wav, mp3 etc) which can be accessed from ASP?
I have an ASP-based website that enables users to design choreography for equestrian dressage. The resulting design is held as a series of coded movements in a database and it can then be reproduced as text or as a series of diagrams. I would like to offer the option of an audio version.
Does anyone have knowledge of converting text file to .iff file. I am working on a VB ASP application. I searched for example on internet but I didn't get anything.
If you have any idea of converting text file to .iff file (VB ASP) please share with me.