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

  • Home
  • SEARCH
  • 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 6642553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:56:40+00:00 2026-05-25T23:56:40+00:00

I am currently writing a program which searches My Documents. Currently my program is

  • 0

I am currently writing a program which searches My Documents. Currently my program is able to search and copy the main my documents folder but I am unable to make it search sub directory’s within the main my documents directory. I have tried multiple methods but none seem to be working out.
Currently I am using the below code to dump the files location into an array called files. sourcePath is declared in an array before hand.

string[] files = System.IO.Directory.GetFiles(sourcePath[loopcounter]);

I then have a loop which copy’s the files over to another directory

foreach (string s in files)

Any help as to how to fill the array files with details of files in the sub directories of a folder would be very handy. Thanks in advance!

  • 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-05-25T23:56:41+00:00Added an answer on May 25, 2026 at 11:56 pm

    Use research by pattern and specify you want use recursion :

    var allFiles = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                     "*",
                                     SearchOption.AllDirectories);
    
    foreach (var item in allFiles)
    {
        // Do Stuff...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a program in which I would like to access the variable
I am currently writing an unmanaged C++ program which works with a system environment
I'm currently learning libgmp and to that end I'm writing a small program which
I'm currently writing a c++ program which should write me a png file as
I'm currently writing a program to generate really enormous (65536x65536 pixels and above) Mandelbrot
I'm currently writing a TYPO3 extension which is configured with a list of tt_content
I'm writing a program which will allow to load a specific managed .DLL file
I'm currently writing a program that needs to compare each file in an ArrayList
I'm currently writing a little program in c++ on my 64bit Ubuntu Pc. By
I am interested in writing a Java program which does the following. Attach to

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.