By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

FSO delete the very last character in tgext file

P: n/a
With ASP, 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.

Thank youi very much
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
*Carol* wrote:
With ASP, 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.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP
Jul 19 '05 #2

P: n/a
"Carol" <kg**@helkusa.com> wrote in message
news:Ws********************@comcast.com...
With ASP, I am generating a huge CSV file. It is to large to open in
notepad.
That's big!
Can I use the Filesystem Scripting Object to read the very last line of
the file and delete the very last character?


You'd be far better off changing the routine that writes it to suppress
this last character, whatever that might be.

HTH,
Phill W.
Jul 19 '05 #3

P: n/a
good to know . thanks you very much. One line at a time. i think I could
handle that since it is written one line at a time in about 15 mintes.

"Andrew Urquhart" <us**************************@spam.invalid> wrote in
message news:xu**************@newsfe5-gui.ntli.net...
*Carol* wrote:
With ASP, 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.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP

Jul 19 '05 #4

P: n/a
If i read one line at a time, how will I know when I hit the last line?

"Andrew Urquhart" <us**************************@spam.invalid> wrote in
message news:xu**************@newsfe5-gui.ntli.net...
*Carol* wrote:
With ASP, 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.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP

Jul 19 '05 #5

P: n/a
*Carol* wrote:
If i read one line at a time, how will I know when I hit the last
line?


http://msdn.microsoft.com/library/en...ndofstream.asp
--
Andrew Urquhart
- Contact me: http://andrewu.co.uk/contact/
- 'Staccato signals of constant information
A loose affiliation of millionaires and billionaires' - Paul Simon
Jul 19 '05 #6

P: n/a
thanks

"Andrew Urquhart" <us**************************@spam.invalid> wrote in
message news:t6**************@newsfe5-gui.ntli.net...
*Carol* wrote:
If i read one line at a time, how will I know when I hit the last
line?

http://msdn.microsoft.com/library/en...ndofstream.asp --
Andrew Urquhart
- Contact me: http://andrewu.co.uk/contact/
- 'Staccato signals of constant information
A loose affiliation of millionaires and billionaires' - Paul Simon

Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.