?
Solved

Copy files

Posted on 2005-03-16
2
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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