Database backup

09/28/2011 17:08 BaussHacker#1
There is this way.
Code:
            if (!System.IO.Directory.Exists("C:\\Database\\BackUp"))
                System.IO.Directory.CreateDirectory("C:\\Database\\BackUp");
            string date = DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + "-" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
            if (!System.IO.Directory.Exists("C:\\Database\\BackUp\\Accounts_" + date))
                System.IO.Directory.CreateDirectory("C:\\Database\\BackUp\\Accounts_" + date);

            string[] Files = System.IO.Directory.GetFiles("C:\\Database\\Accounts");
            foreach (string Account in Files)
            {
                string[] New = Account.Split('\\');
                System.IO.File.Copy(Account, "C:\\Database\\BackUp\\Accounts_" + date + "\\" + New[New.Length - 1]);
            }
It's working and all, but isn't ther any better ways? To me this looks ineffecient.
09/28/2011 18:25 Spirited#2
Well... if you think about it- when you copy a folder in explorer.exe, it transfers documents one by one. Really it's the only way to do it. I did find this though:

[Only registered and activated users can see links. Click Here To Register...]

It looks similar to what you have.
(Ignore the title of the thread, it might not be the best way at all)
I saw one in there that also uses process (which is weird). I doubt that one works.