Pattern matching when Copying

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joecx

    Pattern matching when Copying

    Hi
    If I want to copy files using a pattern like:

    I want all files on a directory that start with 20050822 to be copied to a
    different directory. I can't get file.copy or copyfile to accept *.* pattern
    matching. Does anyone have the code to make this work? Thanx if you can
    help!
  • Rainier

    #2
    RE: Pattern matching when Copying

    If it was my problem to solve I would make an array with all filenames in the
    directory. Filter the array with a custom or parrent matching function like
    System.Text.Reg ularExpressions .Regex.IsMatch( string, pattern)

    don't forget to download a tool to figure out the regular expressions, It
    saves you a headacke.

    --
    Rainier van Slingerlandt
    Microsoft Certified Trainer in Software Development.



    "Joecx" wrote:
    [color=blue]
    > Hi
    > If I want to copy files using a pattern like:
    >
    > I want all files on a directory that start with 20050822 to be copied to a
    > different directory. I can't get file.copy or copyfile to accept *.* pattern
    > matching. Does anyone have the code to make this work? Thanx if you can
    > help![/color]

    Comment

    • Joecx

      #3
      RE: Pattern matching when Copying

      That sounds like the way to go about it but I am new at working with
      directory files. Would you by chance have a routine to list the directory.
      I am not finding the method for doing this. Thanks if you can help!!!

      "Rainier" wrote:
      [color=blue]
      > If it was my problem to solve I would make an array with all filenames in the
      > directory. Filter the array with a custom or parrent matching function like
      > System.Text.Reg ularExpressions .Regex.IsMatch( string, pattern)
      >
      > don't forget to download a tool to figure out the regular expressions, It
      > saves you a headacke.
      >
      > --
      > Rainier van Slingerlandt
      > Microsoft Certified Trainer in Software Development.
      >
      >
      >
      > "Joecx" wrote:
      >[color=green]
      > > Hi
      > > If I want to copy files using a pattern like:
      > >
      > > I want all files on a directory that start with 20050822 to be copied to a
      > > different directory. I can't get file.copy or copyfile to accept *.* pattern
      > > matching. Does anyone have the code to make this work? Thanx if you can
      > > help![/color][/color]

      Comment

      Working...