Please Help Me How to do this, as soon as possible, its very urgent, Thanks in Advance.
Source : C:\Data
Destination : C:\Backup\Data
Write a program that compares one directory to another "including sub-directories if user requires" and keeps them identical by copying or deleting files
and creating or deleting directories in the destination directory.
-> If a file is different in size or date and time then it should be replaced.
-> If a file is does not exist in the destination folder it must be copied.
-> If a file exists in destination but not source it must be deleted from destination.
-> If a directory does not exist in the destination it must be created.
-> If a directory exists in destination but not in source it must be removed from destination.
-> The whole process must be logged in a text file for viewing later.
-> The viewing of logs must be viewed by an external text editor like notepad etc.
-> Keep the data the user has entered in an xml file for ease of reuse.
-> Show a progress bar of the replication process. Create and use classes where possible. Use c# as the language.
Eugene MontesPosted Mar 13, 2015, 9:42 AM
I cannot say for sure but this kinda feels like a homework task or an interns test. Whatever is the case don't you thing that you're little over your head if you need to ask for this code (and you even specify that it's urgent ...).
You must realize that almost any programming community will gladly help their fellow college if he is stuck on something, but to ask someone to write you the whole solution without you lifting a finger for it is considered very rude.
Nevertheless the task that you require to do is not difficult, I will provide you few pointers, but either way I would seriously recommend you to do some more practicing and studying.
Also I would suggest you to visit the TestDome that has many programming tests and try to solve their C# coding tests to see how far you are behind.
Now for the mentioned pointers, there are two classes in .NET that can enable you to iterate through some directory's files:
Directory
DirectoryInfo
First class can only provide you each files path, while the second class can provide you FileInfo class for each file.
These are the only classes that you need to build yourself a solution for first 5 bullets, now for the 6. and 7. you need File class in order to create your log file and after that append the log informations. And last point, well this depends if you are building a Windows Forms or a WPF application, but either way you need a progress bar control.