Click here to Skip to main content
15,920,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best way of stopping program after caught in catch{} Pin
quiteSmart18-Jan-07 22:36
quiteSmart18-Jan-07 22:36 
AnswerRe: Best way of stopping program after caught in catch{} Pin
Russell Jones18-Jan-07 22:33
Russell Jones18-Jan-07 22:33 
AnswerRe: Best way of stopping program after caught in catch{} Pin
Guffa18-Jan-07 22:37
Guffa18-Jan-07 22:37 
QuestionCan we Compare two folders according to size and date modified? Pin
tirumal123118-Jan-07 21:12
tirumal123118-Jan-07 21:12 
AnswerRe: Can we Compare two folders according to size and date modified? Pin
Luc Pattyn18-Jan-07 21:46
sitebuilderLuc Pattyn18-Jan-07 21:46 
AnswerRe: Can we Compare two folders according to size and date modified? Pin
Christian Graus18-Jan-07 21:53
protectorChristian Graus18-Jan-07 21:53 
AnswerRe: Can we Compare two folders according to size and date modified? Pin
Stefan Troschuetz18-Jan-07 21:53
Stefan Troschuetz18-Jan-07 21:53 
AnswerRe: Can we Compare two folders according to size and date modified? [modified] Pin
Michael Sterk18-Jan-07 22:07
Michael Sterk18-Jan-07 22:07 
There is now Explicit Method but try this.
There may are some mistakes because i wrote it without much testing.


private long FolderSize = 0;<br />
<br />
    private bool comparefolders(string path1, string path2)<br />
    {<br />
        string strdate_path1 = string.Empty;<br />
        string strdate_path2 = string.Empty;<br />
        long foldersize1 = 0;<br />
        long foldersize2=0;<br />
        bool folders_compare = false;<br />
        try<br />
        {<br />
            DirectoryInfo dirinfo_path1 = new DirectoryInfo(path1);<br />
            DirectoryInfo dirinfo_path2 = new DirectoryInfo(path2);<br />
            if (dirinfo_path1.Exists == true && dirinfo_path2.Exists == true)<br />
            {<br />
                strdate_path1 = dirinfo_path1.CreationTime.ToString();<br />
                strdate_path2 = dirinfo_path2.CreationTime.ToString();<br />
                foldersize1 = GetFolderSize(path1);<br />
                foldersize2 = GetFolderSize(path2);<br />
                if (foldersize1 == foldersize2 && strdate_path1 == strdate_path2)<br />
                {<br />
                    folders_compare = true;<br />
                }<br />
            }<br />
           <br />
        }<br />
        catch (Exception ex)<br />
        {<br />
            string error = ex.Message;<br />
        }<br />
        return folders_compare;<br />
    }<br />
<br />
    private long GetFolderSize(string Root)<br />
    {<br />
        FolderSize = 0;<br />
        SeekFiles(Root);<br />
        return FolderSize;<br />
    }    <br />
<br />
    private void SeekFiles(string Root)<br />
    {<br />
        string[] Files = System.IO.Directory.GetFiles(Root);<br />
        string[] Folders = System.IO.Directory.GetDirectories(Root);        <br />
        FileInfo File;<br />
        for(int i=0;i<Files.Length-1;i++)<br />
        {<br />
            File = new FileInfo(Files[i]);<br />
            FolderSize += File.Length;<br />
        }<br />
        <br />
        for(int i=0; i< Folders.Length-1; i++)<br />
        {<br />
               SeekFiles(Folders[i]);<br />
        }        <br />
    } 





-- modified at 4:26 Friday 19th January, 2007
GeneralRe: Can we Compare two folders according to size and date modified? Pin
arvmca18-Feb-09 0:44
arvmca18-Feb-09 0:44 
AnswerRe: Can we Compare two folders according to size and date modified? Pin
Luc Pattyn18-Jan-07 22:18
sitebuilderLuc Pattyn18-Jan-07 22:18 
GeneralRe: Can we Compare two folders according to size and date modified? Pin
Michael Sterk18-Jan-07 22:26
Michael Sterk18-Jan-07 22:26 
Questionhow to set location of control programatically?? Pin
Saira Tanwir18-Jan-07 19:49
Saira Tanwir18-Jan-07 19:49 
AnswerRe: how to set location of control programatically?? Pin
stancrm18-Jan-07 20:06
stancrm18-Jan-07 20:06 
GeneralRe: how to set location of control programatically?? Pin
Saira Tanwir18-Jan-07 20:19
Saira Tanwir18-Jan-07 20:19 
QuestionProblem updating datagrid of master form Pin
sopho2418-Jan-07 18:33
sopho2418-Jan-07 18:33 
QuestionRichTextBox Add/Remove Text Pin
et133718-Jan-07 14:36
et133718-Jan-07 14:36 
AnswerRe: RichTextBox Add/Remove Text Pin
Mircea Puiu19-Jan-07 1:19
Mircea Puiu19-Jan-07 1:19 
Questionhow to fax a txt file? Pin
Eddymvp18-Jan-07 12:42
Eddymvp18-Jan-07 12:42 
AnswerRe: how to fax a txt file? Pin
Judah Gabriel Himango18-Jan-07 13:09
sponsorJudah Gabriel Himango18-Jan-07 13:09 
GeneralRe: how to fax a txt file? Pin
Eddymvp18-Jan-07 13:15
Eddymvp18-Jan-07 13:15 
GeneralRe: how to fax a txt file? [modified] Pin
Eddymvp19-Jan-07 3:07
Eddymvp19-Jan-07 3:07 
GeneralRe: how to fax a txt file? Pin
Judah Gabriel Himango19-Jan-07 7:02
sponsorJudah Gabriel Himango19-Jan-07 7:02 
GeneralRe: how to fax a txt file? Pin
Eddymvp19-Jan-07 7:22
Eddymvp19-Jan-07 7:22 
AnswerRe: how to fax a txt file? Pin
Christian Graus18-Jan-07 13:18
protectorChristian Graus18-Jan-07 13:18 
QuestionMenuItemClick not firing on MasterPage with SiteMap Pin
lsugirljte18-Jan-07 11:38
lsugirljte18-Jan-07 11:38 

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.