Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Copy files

Posted on 2005-03-16
2
Medium Priority
?
187 Views
Last Modified: 2010-04-23
Hi,

I am using the following to copy some files out of one directory to another.  As it is, it copies all the files in the source directory.  Is there a way that I can change this so that it only copies the files *Asl.txt (the Asl filename changes on a daily basis).


        Dim DirSource As String = "C:\NadsMailBox\"
        Dim DirTarget As String = "C:\NadsMailBox\Collect\"
        Dim Directory As New System.IO.DirectoryInfo(DirSource)
        Dim file As System.IO.FileInfo
        For Each file In Directory.GetFiles
            file.CopyTo(DirTarget + file.Name)
        Next

Thanks for your help.
0
Comment
Question by:maralans
2 Comments
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 2000 total points
ID: 13560054
       Dim DirSource As String = "C:\NadsMailBox\"
        Dim DirTarget As String = "C:\NadsMailBox\Collect\"
        Dim Directory As New System.IO.DirectoryInfo(DirSource)
        Dim file As System.IO.FileInfo
        For Each file In Directory.GetFiles
            If file.name.IndexOf("Asl.txt") > -1
                file.CopyTo(DirTarget + file.Name)
            end if
        Next
0
 
LVL 5

Author Comment

by:maralans
ID: 13560150
Works just like I wanted.  Thanks for your help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question