比较两个文件夹 [英] Compare between two folders

查看:91
本文介绍了比较两个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我已经设置了一个按钮以及所有内容,我只需要知道如何为它设置代码即可在两个文件夹之间进行检查即可.
当我只单击按钮时,它将访问文件夹而不显示和比较它们.
完成后,我需要在Folder2中删除在Folder1中找不到的文件,但是在删除它们之前,我需要它保存每个文件名,然后再删除,以便可以从ZIP 2中删除它.

Hello,
I have already setted up a button and everything, i just need to know how to setup a code for it to check between two folders..
that when i just click the button, it will access the folders without showing and compare them.
when its done, i need the files that werent found in Folder1 to be deleted in Folder2, but before deleting them I need it to save every files name before it deletes so it can be deleted from a ZIP two.

推荐答案

您可以使用 System.IO.Directory.GetFiles,请参阅:
http://msdn.microsoft.com/en-us/library/system.io. directory.aspx [^ ].

要使用ZIP,您可以使用#ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/ [ http://en.wikipedia.org/wiki/7-Zip [ http://sevenzipsharp.codeplex.com/ [ ^ ].

这两个ZIP库都是开源的.

—SA
You can use System.IO.Directory.GetFiles, please see:
http://msdn.microsoft.com/en-us/library/system.io.directory.aspx[^].

For working with ZIP, you can use #ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/[^].

Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].

Both ZIP libraries are open-source.

—SA


这篇关于比较两个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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