Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 FileSystem object...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 01 December 2004 :  05:17:11  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Curious about something that I cant seem to find via online references...

How do I determine the total number of lines in a text file?
And...
Is it possible to read through a text file line-by-line?

-Stim

Edited by - Da_Stimulator on 01 December 2004 05:25:06

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 01 December 2004 :  05:35:11  Show Profile  Visit HuwR's Homepage
1)
how to read total number of lines :

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("yourfile.txt", 1)
f.ReadAll
response.write "There are " & f.Line & " lines in the specified file."

2) to read a file line by line
Do While Not textStreamObject.AtEndOfStream
LineRead = textStreamObject.ReadLine
Loop
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 01 December 2004 :  05:38:55  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Thx Huw, awsome

-Stim
Go to Top of Page

Podge
Support Moderator

Ireland
3776 Posts

Posted - 01 December 2004 :  05:42:59  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message

You would probably have to iterate through each line and count them.

And...

Yes its possible.

This might help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/FSOoriFileSystemObject.asp

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 01 December 2004 :  06:15:52  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Didnt use any of that... I got frustrated with none of it working and ended up with this

-Stim
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 01 December 2004 :  11:54:58  Show Profile  Visit dayve's Homepage
Bookmark this site: http://www.devguru.com (trust me )

Now read this: http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html

Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 02 December 2004 :  01:27:24  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Thx for the references... although after reviewing in high detail all of the stuff (there was alot), and looking it all over thrice...

I cant seem to find a way to get the file attributes using the OpenTextFile method... (file size, creation date, last modified)

Any suggestions?

-Stim
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 1.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07