473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

copying multiple files from 1 folder to another.

what i have is a folder that has over 1000 pdf's inside it. I also have a program that runs a querey in SAP and returns a text file with certain pdfs that need to be copied into another folder to be shipped out to the field. currently i have my secretary that moves these files manually. I have began to create a program that will read the text file then copy these automaticly. I have been able to make a button and textbox that will create the new folder, button that will load the text file into the text box.
The problem i am having is reading the textbox that will concatenate the textbox with the file name and copy it into the new folder. here is the code i have currently


Imports System.IO

Imports System.Convert
Imports Microsoft.VisualBasic.ControlChars

Public pstrLine As String


Function FileToArray(ByVal filePath As String) As String()
Dim content As String
Dim lines As New ArrayList
Dim sr As System.IO.StreamReader

' read the file's lines into an ArrayList
Try
sr = New System.IO.StreamReader(filePath)
Do While sr.Peek() >= 0
lines.Add(sr.ReadLine())
Loop
Finally
If Not sr Is Nothing Then sr.Close()
End Try

' convert from ArrayList to a String array
Return CType(lines.ToArray(GetType(String)), String())
End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load

End Sub





Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


Try
Directory.CreateDirectory("c:\" & TextBox1.Text)

Catch
End Try
MsgBox("Done")
End Sub



Private Sub btnOpenTextFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenTextFile.Click

Dim pstrLine, pstrFile As String
Dim psrdCurrent As System.IO.StreamReader
ofdCommon.ShowDialog()
psrdCurrent = New System.IO.StreamReader(ofdCommon.FileName)
pstrLine = psrdCurrent.ReadLine()
Do Until pstrLine = Nothing
pstrFile += pstrLine & CrLf
pstrLine = psrdCurrent.ReadLine()
Loop
psrdCurrent.Close()
TextBox3.Text = pstrFile
End Sub
Private Sub btncopyFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncopyFiles.Click

End Sub

End Class


Please Help
Mar 29 '08 #1
0 1188

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
5
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
4
by: tshad | last post by:
I have an old version of VS 2002 and want to make a copy of my Visual Studio project to another project with another name. In VS 2003, you can do it but there is no copy project command in VS 2002...
2
by: Jerad Rose | last post by:
I have a fairly simple C# console app which copies files from a network folder to a local folder. When the app resides on my local C: drive, it runs just fine. However, when the app resides on a...
5
by: cybersangeeth | last post by:
Hi, I need to read 1KB each time from multiple files in a folder and pass it to a byte array in a struct to be sent through a socket. I'm a C++ newbie. I managed to read 1KB each time from one...
1
by: CarrieR | last post by:
Hello, I'm not sure if this is the right forum for this question -- I apologize if not! I am also somewhat of a novice with all of this. I have a folder of around 20,000 wav files, and I need to...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
1
by: skygremlin | last post by:
I am trying to write a simple VB app to copy all directories and files off a thumb drive to a directory on a pc. I have a couple things I am trying to automate. Final Build will: - Have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.