Results 1 to 2 of 2

Thread: GetDirectories

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    GetDirectories

    Hi!
    I am writing my code in c#.

    I have a Main directory and sub directories under it.

    Say my main directory is "ABC" and subdirectories under it are "CP200", "CP201", "Errors", "Hello".

    I have to write a code in C# to get the subdirectories starting with "CP" i.e my code should return "CP200" and "CP201".

    How to achieve it?

    Thanks,

    Sid.
    Thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: GetDirectories

    Code:
    string[] folders = System.IO.Directory.GetDirectories(@"C:\ABC", "CP*");
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width