Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8963131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:17:30+00:00 2026-06-15T16:17:30+00:00

I have got table named FILELISTS Table Name – Filelists Field – FileNames Data

  • 0

I have got table named FILELISTS

Table Name - Filelists
Field - FileNames

Data Value

  1. File1.txt
  2. File2.csv
  3. File3*.csv

I’m struggling to write the code, as per above if it has a file name (like file1.txt and file2.txt) it needs to copy from source to destination. If file name is pattern (like File3*.csv) then copy all files that matches this pattern from source to destination.

I’m enumerating through above row in Vb.net using data reader.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:17:32+00:00Added an answer on June 15, 2026 at 4:17 pm

    You can use Directory.EnumerateFiles and File.Copy, for example:

    var filePatterns = database.GetFileNamePattern(); // your method that returns the list of files
    // assuming you've stored the source- and dest.-directories in the app-settings
    string sourceFolder = Properties.Settings.Default.SourceFolder;      
    string destFolder = Properties.Settings.Default.DestinationFolder;
    foreach (string pattern in filePatterns)
    {
        var files = Directory.EnumerateFiles(
            sourceFolder,
            pattern,
            SearchOption.TopDirectoryOnly);
        foreach (string file in files)
        {
            File.Copy(file, Path.Combine(destFolder, Path.GetFileName(file)), true);
        }
    }
    

    Edit: Sorry, here the VB.NET version:

    ' your method that returns the list of files:
    Dim filePatterns = database.GetFileNamePattern()  
    ' assuming you've stored the source- and dest.-directories in the app-settings
    Dim sourceFolder As String = My.Settings.SourceFolder
    Dim destFolder As String = My.Settings.DestinationFolder
    For Each pattern As String In filePatterns
        Dim files = Directory.EnumerateFiles(sourceFolder, pattern, SearchOption.TopDirectoryOnly)
        For Each file As String In files
           IO.File.Copy(file, IO.Path.Combine(destFolder, IO.Path.GetFileName(file)), True)
        Next
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a looklup table, its got an ID and a NAME field. The
I've got a problem with my SQL. I have a table (named Regions) looking
For example, I have a table name test_table and has a column named column_A
I have a mysql database with a table named games and a blob field
We have a table named tags which has 3 cols: id, value, count which
i've got a database with a table named PropertyValues where i store every value
I've got 2 tables, named: csv (a csv dump) , and items (primary data
I've got an array of names: $names = array('ray'=>0,'bob'=>1,'sue'=>2,'jeff'=>3); Then I have a table
I have got two tables: Event +----------+---------+--------------+ | event_id | name | date |
I have got a table [newsletter] in the db, which saves the email address,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.