English 中文(简体)
C#
原标题:Make a Backup Utility in C#
  • 时间:2010-08-25 16:46:39
  •  标签:
  • c#
  • utility

我把“后台”视为我的下一个项目想法,但我并不真正知道何时开始或应如何进行支持。

任何人都能够了解哪些档案备份和恢复方法。

增 编

最佳回答

首先,我不相信我会看到任何名称空间或阶级。 NET Framework specified for supportup/archive/restore activities. 如果任何人都知道任何东西,那就让我们 enlighten!

简而言之,支持档案只是复制从一个地点到另一个地点的文件。 请允许我说,你有源代码,希望保持支持,并且每天改写。 你们可以建立一个小的专线,简单地将目标夹中的所有档案复制到外部驱动器上,翻写自上一次复印业务以来已经改变的任何档案,并将任何新的档案和文件加到目的地。 然后,在计算机没有被其他使用时,或者至少在源头没有编辑时,使用一个表列的任务,每天操作一次。

该系统有许多方法和课程。 IO名称空间使这项工作相对容易。

IO名称空间的一些有用的课程是:

  • Directory provides static methods for creating, moving and enumerating through directories and subdirecties
  • DirectoryInfo is a class exposing properties of Folders/Directories
  • File provides static methods for files
  • FileInfo is a class exposing properties of files.

这里有一部法典样本,将给你带来一系列最高级的夹子,紧靠C的根基:

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]);
}
问题回答

比较容易的方法之一是:

  1. Allow user to select target folder and destination, and destination type (Zip, copy, etc)
  2. Copy/Compress the files and sub folders inside target folder to destination

如果你只是想要复制档案,那么你就可以利用名录信息系统和文档信息系统获得目录、档案和档案,并做文件Copy、档案等。

如果你想要在目的地压缩档案,那么你也可以使用像7z这样的现有图书馆,该图书馆也有C#的编码。

阿尔法维安S将VSS(Volume影印机服务)的全文暴露在网络代码上。 这将使你能够利用有管理的守则,对某个时间点进行解剖。

  • Are you planning on backing up sector-by-sector, or file-by-file?
  • Will your backup run as an Admin (access to all files) or as a User (access to only some files)?
  • How do you safeguard Admin-level information now stored in your backup file from User-level viewers?
  • Must your target medium have adequete space for the backup (large network drive) or will the backup be able to span several media? (CDROMs)
  • In the latter case, how will you deal with individual files bigger than a single target media?
  • Will you always do a full backup (everything, always) or an incremental (just what changes since the last backup) or a differential (just what changes since the last full backup)?




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签