Answer the question
In order to leave comments, you need to log in
How to track file changes, and roll back changes if necessary c#?
In general, on the coursework, they asked me to write a program that will track files in a folder that have changed and make backups on them, with the ability to return to the old version of the file .. Tell me how this can be implemented ???
Answer the question
In order to leave comments, you need to log in
1 - FileSystemWatcher of course .. 2 - but here you need to catch that the watcher will report that the file has been changed ... that there was an opportunity to roll back
to something there - it is necessary that a backup copy already exists before the change ... then - create think, try
Well, the first thing that comes to mind is to use git
. You just run git commands somewhere in your program
. For example, you need to make a backup in the program and you do something like
ProcessStartInfo psi;
psi = new ProcessStartInfo("cmd", $"git commit -a -m { backup_name }");
Process.Start(psi);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question