使用C#将一个目录与另一个目录进行比较 [英] program that compares one directory to another using C#

查看:174
本文介绍了使用C#将一个目录与另一个目录进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我如何做到这一点,尽快,非常紧急,在此先感谢,



来源:C:\ Data



目的地:C:\ Backup \Data





编写程序将一个目录与另一个目录(包括用户需要的子目录)进行比较,并通过复制或删除文件来保持它们相同,并在目标目录中创建或删除目录。

- >如果文件的大小或日期和时间不同,则应将其替换。

- >如果目标文件夹中不存在文件,则必须将其复制。

- >如果文件存在于目标但不存在源,则必须从目标中删除该文件。

- >如果目标中不存在目录,则必须创建该目录。

- >如果目录存在于目标但不存在于源中,则必须从目标中删除该目录。

- >整个过程必须记录在文本文件中以供日后查看。

- >必须通过外部文本编辑器(如记事本等)查看日志。

- >将用户输入的数据保存在xml文件中以便于重用。

- >显示复制过程的进度条。尽可能创建和使用类。使用c#作为语言。

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.

推荐答案

你的作业将被设置为测试所学的东西,而不是互联网上一些随机的人知道的。



如果你不能自己做作业,那就跟老师谈谈。



虽然我们'很乐意帮助解决有关您编写的代码的特定问题,我们不会为您做好功课。
Your homework is set to test what you have learned, not what some random people on the Internet know.

If you cannot do your own homework, then talk to your teacher.

Whilst we're happy to help with specific questions about code you have written, we will not do your homework for you.


开发一些备份的应用程序C:\\ \\ datatoC:\ Backup \ Data不值得努力,甚至不作为学习任务。这不仅会破坏编程的目的,而且会破坏计算和使用计算机的目的。如果您没有尝试自己解决所有问题,那么没有任何帮助对您有所帮助。



-SA
Developing some application which backs up "C:\Data" to "C:\Backup\Data" won't worth the effort, not even as a study task. This would defeat the purpose no only programming, but computing and using computers in general. And if you did not try to solve it all by yourself, no help can be helpful for you.

—SA


这篇关于使用C#将一个目录与另一个目录进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆