Click here to Skip to main content
12,452,066 members (24,041 online)
   

C#

 
GeneralRe: Sample Code for SetWinEventHook in C# Pin
Artem Taradeiko25-Sep-13 5:17
memberArtem Taradeiko25-Sep-13 5:17 
QuestionHow to detect if a service is running or not Pin
bouli15-Jan-07 20:57
memberbouli15-Jan-07 20:57 
AnswerRe: How to detect if a service is running or not Pin
Kodanda Pani15-Jan-07 23:19
memberKodanda Pani15-Jan-07 23:19 
AnswerRe: How to detect if a service is running or not Pin
justintimberlake16-Jan-07 1:00
memberjustintimberlake16-Jan-07 1:00 
GeneralRe: How to detect if a service is running or not Pin
bouli16-Jan-07 2:11
memberbouli16-Jan-07 2:11 
QuestionTemplate Programming Pin
sivaprakashshanmugam15-Jan-07 20:20
membersivaprakashshanmugam15-Jan-07 20:20 
AnswerRe: Template Programming Pin
Christian Graus15-Jan-07 21:43
staffChristian Graus15-Jan-07 21:43 
QuestionRecursive directory search Pin
electriac15-Jan-07 20:06
memberelectriac15-Jan-07 20:06 
I have tested this significantly and it gets curious-er. I installed a drive that has nothing but MP3 files on it. I went in a command com and issued a “Dir *.mp3 /b /s > test.txt” to create a list of all the files on the drive. I read the file with a text editor and there are 17,247 files listed. Okay I run the program I have been testing and it finds only 16800 files. Here is the code I used to which I introduced a counter with which I report to a message box in order to confirm the exact number in the array. The number in the array agrees with countFiles.

void DirSearch(string sDir)
        {
            try
            {
                foreach (string d in Directory.GetDirectories(sDir))
                {
                    foreach (string f in Directory.GetFiles(d, "*.mp3"))
                    {
                        //listBox1.Items.Add(f);
                        arrText.Add(f);
                        countFiles++;
                    }
                    DirSearch(d);
                }
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }

Upon examintion of the array in the list box there is also 16,800 files in the list box but I notice that I have a directory for “World” music which is not present in the list. Out of curiosity I change the name of the directory from “World” to “aWorld” and run the program without any other changes. The program reports 17,005 files which reflects the approximate number of files in the “World” directory.

It seems that there is something strange happening in DirSearch that is beyond my feeble mind. Since it will not read anything alphabeticaly beyond “Rock and Roll” could there be some kind of musical prejudice at work? That’s a joke.


AnswerRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 21:04
memberLuc Pattyn15-Jan-07 21:04 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:19
memberelectriac15-Jan-07 21:19 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:52
memberelectriac15-Jan-07 21:52 
GeneralRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 22:22
memberLuc Pattyn15-Jan-07 22:22 
AnswerRe: Recursive directory search Pin
Christian Graus15-Jan-07 21:48
staffChristian Graus15-Jan-07 21:48 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 21:54
memberelectriac15-Jan-07 21:54 
GeneralRe: Recursive directory search Pin
Christian Graus15-Jan-07 22:00
staffChristian Graus15-Jan-07 22:00 
GeneralRe: Recursive directory search Pin
electriac15-Jan-07 22:09
memberelectriac15-Jan-07 22:09 
AnswerRe: Recursive directory search Pin
Luc Pattyn15-Jan-07 22:27
memberLuc Pattyn15-Jan-07 22:27 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 0:21
memberelectriac16-Jan-07 0:21 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 1:14
memberLuc Pattyn16-Jan-07 1:14 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 1:31
memberelectriac16-Jan-07 1:31 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 1:31
memberLuc Pattyn16-Jan-07 1:31 
GeneralRe: Recursive directory search Pin
electriac16-Jan-07 1:36
memberelectriac16-Jan-07 1:36 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 2:20
memberLuc Pattyn16-Jan-07 2:20 
GeneralRe: Recursive directory search Pin
Luc Pattyn16-Jan-07 2:46
memberLuc Pattyn16-Jan-07 2:46 
AnswerRe: Recursive directory search Pin
davidc2p16-Jan-07 6:03
memberdavidc2p16-Jan-07 6:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 27 Aug 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid