473,797 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copying multiple files from 1 folder to another.

2 New Member
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.Visua lBasic.ControlC hars

Public pstrLine As String


Function FileToArray(ByV al filePath As String) As String()
Dim content As String
Dim lines As New ArrayList
Dim sr As System.IO.Strea mReader

' read the file's lines into an ArrayList
Try
sr = New System.IO.Strea mReader(filePat h)
Do While sr.Peek() >= 0
lines.Add(sr.Re adLine())
Loop
Finally
If Not sr Is Nothing Then sr.Close()
End Try

' convert from ArrayList to a String array
Return CType(lines.ToA rray(GetType(St ring)), String())
End Function

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e _
As System.EventArg s) Handles MyBase.Load

End Sub





Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click


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

Catch
End Try
MsgBox("Done")
End Sub



Private Sub btnOpenTextFile _Click(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnOpenTextFile .Click

Dim pstrLine, pstrFile As String
Dim psrdCurrent As System.IO.Strea mReader
ofdCommon.ShowD ialog()
psrdCurrent = New System.IO.Strea mReader(ofdComm on.FileName)
pstrLine = psrdCurrent.Rea dLine()
Do Until pstrLine = Nothing
pstrFile += pstrLine & CrLf
pstrLine = psrdCurrent.Rea dLine()
Loop
psrdCurrent.Clo se()
TextBox3.Text = pstrFile
End Sub
Private Sub btncopyFiles_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btncopyFiles.Cl ick

End Sub

End Class


Please Help
Mar 29 '08 #1
0 1254

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

Similar topics

5
10533
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 do this? (IIS 5 or 6 In case you're wondering why I would do this, we have many web sites on a single server, and there are groups of sites that need to share common configuration information. I'd like to ease some administration by having one...
5
2355
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 with a few ounces of hard-won knowledge as well. Meanwhile I have this (hopefully small) problem.
10
7839
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 'to.txt' I specify where to copy it - After I read content of 'to.txt' I create one more subfolder named by current date and thats where everything gets to be copied
4
1406
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 (at least I can't seem to find it). Is there a way to do it? Thanks, Tom
2
8094
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 network drive, copying the same files from the same source drive and to the same destination drive, it gives me the following exception: System.Security.SecurityException: Request for the permission of type...
5
3978
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 file and store it on to another file using the following code. Could anyone please let me know how i could go about reading from multiple files. Thanks in advance. typedef struct {
1
1278
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 find a way to RANDOMLY extract 400 files from this folder into another, to use for analysis. Is there a way to do this within a cmd prompt, say within an xcopy command? Or is this something that perhaps can be done within an Access module? (Of...
13
10732
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 process the file. The appearance of the command file triggers the device to grab the original file. My problem is I don't want to write the command file to the device until the original file from the workflow has been copied completely. Since these...
1
2268
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 multiple USB connections for multiple drives to copy from at the same time - Have seperate directories for each individual who will copy to the pc - Have a list box where I would like to choose which directory (Individual) to copy files to, and a...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10209
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9066
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.