Click here to Skip to main content
15,884,388 members
Home / Discussions / C#
   

C#

 
QuestionSQL connectivity issue in My own Windows Serive Pin
WinCrs27-Jan-10 0:29
WinCrs27-Jan-10 0:29 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
SeMartens27-Jan-10 0:53
SeMartens27-Jan-10 0:53 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
Covean27-Jan-10 1:01
Covean27-Jan-10 1:01 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
PIEBALDconsult27-Jan-10 5:32
mvePIEBALDconsult27-Jan-10 5:32 
GeneralRe: SQL connectivity issue in My own Windows Serive Pin
WinCrs27-Jan-10 18:19
WinCrs27-Jan-10 18:19 
Questionrecursive folder compare Pin
vantoora26-Jan-10 23:39
vantoora26-Jan-10 23:39 
AnswerRe: recursive folder compare Pin
SeMartens26-Jan-10 23:55
SeMartens26-Jan-10 23:55 
GeneralRe: recursive folder compare Pin
vantoora27-Jan-10 19:00
vantoora27-Jan-10 19:00 
Thanks for your prompt reply but i think i found another idea. That's getting the list of the first server and try to find it into the second server. If the folder exist, do not care, otherwise log the foldername.fullpath.

for example, suppose i have this :
S1 : c:\rootfolder_S1\folder1\folder2\folder3
S2 : c:\rootfolder_S2\folder1\folder2\folder3

beginning from c:\rootfolder
- get list of folders for one level i got : folder1
- used Path.GetFileNameWithoutExtension(dir) and got : folder1
- use the Path.Combine(S2, foldername) and got : c:\rootfolder_S2\folder1

It's ok and very nice algorithm. But my problem, now, is how can i use this if recursing folders in S1. Using Path.GetFileNameWithoutExtension(dir) will get only the last name of the folder and if combining with S2, will got error or something else.

What i'm going to try is check the size of S1 (rootfolder only), and then use the substring(index) before combining with S2, but how can i get the size or lenght of S1. S1 : c:\rootfolder -> should have 13 characters.

This is my sample code :
static void Main(string[] args)
        {            
            CombinePaths(args[0], args[1]);
        }

private static void CombinePaths(string p1, string p2)
        {
            string[] dirs = Directory.GetDirectories(p1);
            foreach (string dir in dirs)
            {
                try
                {
                    int index = dir.LastIndexOf("\\") + 1;
                    string foldername = dir.Substring(index);
                    string combination = Path.Combine(p2, foldername);
                    if (!Directory.Exists(combination))
                    {
                        Console.WriteLine(dir);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                Console.WriteLine(Path.GetFileNameWithoutExtension(dir));
                // RecurseFolder(dir,dirs);
            }
        }


this is what i have for now. I'll reply back if found how to have the number of the character of the source string.

Maybe not yet very clear my code but think it is still a draft code.

See you later.
GeneralRe: recursive folder compare Pin
vantoora29-Jan-10 2:16
vantoora29-Jan-10 2:16 
QuestionRendering issue C# Pin
Paul Harsent26-Jan-10 23:28
Paul Harsent26-Jan-10 23:28 
AnswerRe: Rendering issue C# Pin
tolw27-Jan-10 19:30
tolw27-Jan-10 19:30 
QuestionExplicit casting with Type variable Pin
Kaikus26-Jan-10 23:21
Kaikus26-Jan-10 23:21 
AnswerRe: Explicit casting with Type variable Pin
OriginalGriff26-Jan-10 23:45
mveOriginalGriff26-Jan-10 23:45 
GeneralRe: Explicit casting with Type variable Pin
Kaikus27-Jan-10 0:48
Kaikus27-Jan-10 0:48 
GeneralRe: Explicit casting with Type variable Pin
OriginalGriff27-Jan-10 1:16
mveOriginalGriff27-Jan-10 1:16 
GeneralRe: Explicit casting with Type variable Pin
Kaikus27-Jan-10 22:21
Kaikus27-Jan-10 22:21 
GeneralRe: Explicit casting with Type variable Pin
Gideon Engelberth27-Jan-10 4:40
Gideon Engelberth27-Jan-10 4:40 
GeneralRe: Explicit casting with Type variable Pin
Kaikus27-Jan-10 22:26
Kaikus27-Jan-10 22:26 
GeneralRe: Explicit casting with Type variable Pin
Gideon Engelberth28-Jan-10 2:47
Gideon Engelberth28-Jan-10 2:47 
AnswerRe: Explicit casting with Type variable Pin
PIEBALDconsult27-Jan-10 5:33
mvePIEBALDconsult27-Jan-10 5:33 
QuestionExecute smtpclient authenticate method from reflection? Pin
ankit_verma26-Jan-10 23:14
ankit_verma26-Jan-10 23:14 
AnswerRe: Execute smtpclient authenticate method from reflection? Pin
SeMartens26-Jan-10 23:45
SeMartens26-Jan-10 23:45 
GeneralRe: Execute smtpclient authenticate method from reflection? Pin
ankit_verma26-Jan-10 23:48
ankit_verma26-Jan-10 23:48 
GeneralRe: Execute smtpclient authenticate method from reflection? Pin
SeMartens26-Jan-10 23:53
SeMartens26-Jan-10 23:53 
GeneralRe: Execute smtpclient authenticate method from reflection? Pin
ankit_verma27-Jan-10 0:10
ankit_verma27-Jan-10 0:10 

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.