I'm thinking of a Backup Utility as my next project idea, but I don't really know where to start or how the backups should be made.
Can anyone shine some light on what methods of archiving backups and restoring etc. is done.
Thanks
To start with, I don't believe I've seen any namespace or classes in the .NET Framework specifically designed for backup/archive/restore activities. If anyone knows of any, well, enlighten us please!
At its simplest, backing up files is simply copying files from one location to another. Let's say that you have source code that you would like to maintain a backup of, and it changes a bit day by day. You could create a small console app that would simply copy all the files in the target folders to an external drive, overwriting any files that had changed since the last copy operation, and adding any new files and folders to the destination. Then use a Scheduled Task to run the utility once per day at a time when the computer is not being otherwise used -- or at least when the source is not being edited.
There are lots of methods and classes in the System.IO namespace that will make this relatively easy to do.
Some useful classes in the IO namespace are:
Here's a code sample that would give you an array of all the top-level folders just under the root of the C: drive:
string[] d = Directory.GetDirectories(@"C\", "*.*", SearchOption.TopDirectoryOnly);
DirectoryInfo[] di = new DirectoryInfo[d.Length];
for (int x = 0; x < d.Length; x++)
{
di[x] = new DirectoryInfo(d[x]);
}