|
-
Jan 23rd, 2005, 08:13 PM
#1
Thread Starter
New Member
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
-
Jan 23rd, 2005, 08:21 PM
#2
Re: Problem Creating Files
What is it that you do that needs creation of 25,000 files ??? Nothing malicious I hope?
-
Jan 23rd, 2005, 08:26 PM
#3
Re: Problem Creating Files
I think the buffer fills up, and you have to wait before you can write more files.
-
Jan 23rd, 2005, 08:34 PM
#4
Thread Starter
New Member
Re: Problem Creating Files
How can increase the buffer???
-
Jan 23rd, 2005, 08:37 PM
#5
Thread Starter
New Member
Re: Problem Creating Files
 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.
-
Jan 23rd, 2005, 08:38 PM
#6
Re: Problem Creating Files
For that many files you may have to split them into a LOT of sub folders.
-
Jan 23rd, 2005, 08:39 PM
#7
Re: Problem Creating Files
 Originally Posted by Medianutz
I am creating web pages.
I saw that part ... but what are they for ???
-
Jan 23rd, 2005, 08:43 PM
#8
Re: Problem Creating Files
This is .NET code, not VB6.
I know this is a long shot, but try:
Code:
oWrite = Nothing
oFile = Nothing
WOka
-
Jan 23rd, 2005, 08:43 PM
#9
Thread Starter
New Member
Re: Problem Creating Files
RhinoBull,
I am creating seo pages for marketing a few sites we designed.
Medianutz
-
Jan 23rd, 2005, 08:47 PM
#10
Re: Problem Creating Files
If you are using .NET why don't you create one page using ASP.NET, that will dynamically query the database? Or is this not an option?
WOka
-
Jan 23rd, 2005, 08:49 PM
#11
Thread Starter
New Member
Re: Problem Creating Files
That would work , but static pages work better with the spiders.
-
Jan 23rd, 2005, 09:01 PM
#12
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
-
Jan 23rd, 2005, 09:54 PM
#13
Thread Starter
New Member
Re: Problem Creating Files
Inkintome does not like them on the xml feed.
-
Jan 24th, 2005, 03:07 AM
#14
Addicted Member
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.
-
Jan 24th, 2005, 09:10 AM
#15
Thread Starter
New Member
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
-
Jan 24th, 2005, 09:14 AM
#16
Thread Starter
New Member
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
-
Jan 24th, 2005, 09:20 AM
#17
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
-
Jan 24th, 2005, 09:31 AM
#18
Thread Starter
New Member
Re: Problem Creating Files
Woka,
I will try this when I get home.
Thank you for all your help.
Medianutz
-
Jan 24th, 2005, 09:39 AM
#19
Re: Problem Creating Files
It's exactly the same code as you had But it worked for me.
Woka
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|