none
Problem to process all files

    Question

  • Hi,
    I want to scan the given path, by these
            static void DirSearch(string directoryPath,string par_OutFile)
            {
                string OutFile = par_OutFile;
                ...
                try
                {
    
                    var dirs = Directory.EnumerateDirectories(directoryPath, "*.*", SearchOption.AllDirectories);
                    foreach (var dir in dirs)
                    {
                        var info = new DirectoryInfo(dir);
                                ...


    but it does not run against all files of the given folder. Why?

    Many Thanks & Best Regards, Hua Min


    Thursday, April 6, 2017 6:53 AM

Answers

  • In your EnumerateDirectories call you are specifying a mask of *.*. That is generally only done for files. Are you sure you shouldn't be using * instead. The way it looks, but I haven't tested, you would only pick up directories with dots in the name.

    If you could provide examples of directories that are and aren't working it would help narrow things down.

    Michael Taylor
    http://www.michaeltaylorp3.net

    • Marked as answer by HuaMin Chen Friday, April 7, 2017 1:53 AM
    Thursday, April 6, 2017 3:47 PM
    Moderator

All replies

  • Is it possible that you are running in the same virtualization problem, as described here: http://stackoverflow.com/questions/30310805/missing-directory-and-file-info ?

    Thursday, April 6, 2017 7:39 AM
  • In your EnumerateDirectories call you are specifying a mask of *.*. That is generally only done for files. Are you sure you shouldn't be using * instead. The way it looks, but I haven't tested, you would only pick up directories with dots in the name.

    If you could provide examples of directories that are and aren't working it would help narrow things down.

    Michael Taylor
    http://www.michaeltaylorp3.net

    • Marked as answer by HuaMin Chen Friday, April 7, 2017 1:53 AM
    Thursday, April 6, 2017 3:47 PM
    Moderator
  • As a general rule the OP is responsible for selecting the best answer for their post. If the OP has marked a post as answered a moderator will not remove it. Only when a post remains unanswered by the OP will a moderator mark the post. That has not happened here.

    "Try to be professional this time, and use your special credential, properly. And try not to edit your post after the thread gets some days old (and delete the timestamp of the editing day)."

    Your continued accusations against the moderators in these forums is unacceptable and against forum rules pertaining to slander. Please provide evidence that the moderators in these forums are doing the actions that you claim so that the community as a whole can judge these actions. Up until this point you've made this claim multiple times but have never provided any proof. Moderators in these forums can see every edit and delete of every post and I can assure you this has not happened in any of the cases you've mentioned before. The only times I've seen any moderator edits is when the post in question was of such an offensive nature that it needed to be removed. Some moderators also delete posts that are violations of the forum rules. However this hasn't happened in the threads I've seen either.

    If you cannot provide proof then please delete your post so that it does not look negative against your reputation in these forums. We can bring in an administrator to investigate this situation if you'd like. However they will be taking a careful look at all the posts mentioned and the users posting it to evaluate the situation. I'm not really sure you want to do that but I leave the decision up to you.

    Friday, April 7, 2017 8:23 PM
    Moderator