Results 1 to 19 of 19

Thread: Problem Creating Files

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Problem Creating Files

    Hello,
    Is there a limit of to the number of files you can create in a folder on Win XP Pro SP2. I am trying to create 25,000 files that are about 2-7kb. When i run my program only 111 files are created. I have include the major part of the program. Can any body see what I am doing wrong?

    Thanks,
    Medianutz


    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

    Dim CNkeywords As ADODB.Connection
    Dim RSkeywords As ADODB.Recordset
    CNkeywords = New ADODB.Connection
    CNkeywords.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kw.mdb")
    CNkeywords.Open()

    Dim count As Integer
    Dim strSQl As String
    Dim I As Integer
    Dim page As String
    Dim place As String
    Dim c As Integer
    place = "C:\kwdata"
    System.IO.Directory.CreateDirectory(place)
    I = 0
    c = 0


    strSQl = "SELECT * FROM keywords" ' where date is null" '< '" & Today & "'"
    RSkeywords = New ADODB.Recordset
    RSkeywords.ActiveConnection = CNkeywords
    RSkeywords.CursorType = ADODB.CursorTypeEnum.adOpenStatic
    RSkeywords.LockType = ADODB.LockTypeEnum.adLockOptimistic
    RSkeywords.Open(strSQl)
    count = RSkeywords.RecordCount

    Do While c <= count
    page = Replace(RSkeywords.Fields("keyword").Value(), " ", "_") & ".asp"
    createfile(RSkeywords.Fields("keyword").Value(), place & "\" & page)
    TextBox1.Text = TextBox1.Text & RSkeywords.Fields("keyword").Value() & ", "
    c = c + 1
    Label2.Text = c
    RSkeywords.Fields("date").Value() = Today
    RSkeywords.Update()
    RSkeywords.MoveNext()
    Loop

    RSkeywords.Close()
    CNkeywords.Close()
    CNkeywords = Nothing

    End Sub

    Function createfile(ByVal kw As String, ByVal location As String)

    Dim oFile As System.IO.File
    Dim oWrite As System.IO.StreamWriter
    oWrite = oFile.CreateText(location)


    oWrite.WriteLine("<html><head>")
    oWrite.WriteLine("<title>" & kw & "</title>")
    oWrite.WriteLine("<meta name='keywords' content='" & getkw(kw) & "'>")
    oWrite.WriteLine("<meta name='description' content='" & getkw(kw) & "'>")
    oWrite.WriteLine("</head><body>")
    oWrite.WriteLine("<table border=1>")
    oWrite.WriteLine("<tr>")
    oWrite.WriteLine("<td>")
    oWrite.WriteLine(getlinks(kw))
    oWrite.WriteLine("</td>")
    oWrite.WriteLine("<td>")
    oWrite.WriteLine("</td>")
    oWrite.WriteLine("</table>")
    oWrite.WriteLine("</body></html>")
    oWrite.Close()

    End Function

  2. #2

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Problem Creating Files

    I think the buffer fills up, and you have to wait before you can write more files.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    How can increase the buffer???

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    Quote Originally Posted by RhinoBull
    What is it that you do that needs creation of 25,000 files ??? Nothing malicious I hope?
    I am creating web pages.

  6. #6
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Problem Creating Files

    For that many files you may have to split them into a LOT of sub folders.

  7. #7

  8. #8

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    RhinoBull,
    I am creating seo pages for marketing a few sites we designed.

    Medianutz

  10. #10

  11. #11

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    That would work , but static pages work better with the spiders.

  12. #12
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Problem Creating Files

    Is that a good thing?

    Amazon isn't static but you can still find individual items on it by searching in google...?
    Am I missing something?

    WOka

  13. #13

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    Inkintome does not like them on the xml feed.

  14. #14
    Addicted Member Chrispybee's Avatar
    Join Date
    Sep 2003
    Location
    North Wales, UK
    Posts
    217

    Re: Problem Creating Files

    This question should be in the .asp or web building forum.

    I did find a webpage in google on how to make dynamic pages found using search engines.

  15. #15

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    Hi Woka,
    I added:
    oWrite = Nothing
    oFile = Nothing

    I also added a loop that counts 1->1000000 to allow time for the buffer to catch up. However I am still getting the same problem. Thank you very much for the suggestion.

    Medianutz

  16. #16

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    [QUOTE=Chrispybee]This question should be in the .asp or web building forum.

    QUOTE]

    Chrispybee,
    I am using vb to create the files which are asp. So why should this not be in the vb forum?

    Medianut

  17. #17
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Problem Creating Files

    Code:
    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    No, you are using .NET to create the files.

    Well, I have done:
    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    		Dim Index As Long
    		For Index = 1 To 10000
    			createfile("C:\Arse\File" & Index.ToString & ".htm")
    		Next
    	End Sub
    
    
    	Private Sub createfile(ByVal location As String)
    
    		Dim oFile As System.IO.File
    		Dim oWrite As System.IO.StreamWriter
    		oWrite = oFile.CreateText(location)
    		oWrite.WriteLine("<html><head>")
    		oWrite.WriteLine("<title>" & location & "</title>")
    		oWrite.WriteLine("<meta name='keywords' content='Woof'>")
    		oWrite.WriteLine("<meta name='description' content='moose'>")
    		oWrite.WriteLine("</head><body>")
    		oWrite.WriteLine("<table border=1>")
    		oWrite.WriteLine("<tr>")
    		oWrite.WriteLine("<td>")
    		oWrite.WriteLine("</td>")
    		oWrite.WriteLine("<td>")
    		oWrite.WriteLine("</td>")
    		oWrite.WriteLine("</table>")
    		oWrite.WriteLine("</body></html>")
    		oWrite.Close()
    		oWrite = Nothing
    		oFile = Nothing
    	End Sub
    And it's just created 10,000 files on my PC. It seemed to do that perfectly.

    Woka

  18. #18

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    Re: Problem Creating Files

    Woka,
    I will try this when I get home.
    Thank you for all your help.

    Medianutz

  19. #19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width