Backup Algorithm

I am looking at creating a program (.Net) to back up files to a computer. How can I find out which files have changed for the backup (I don't want to check the last modified dates every time.

Are there backup algorithms to back up only the bits of the file. What is the O notation for an algorithm?

0


source to share


4 answers


Check the archive bit . This might be what you want.

In .NET, it System.IO.FileAttributes.Archive

which can be used with SetAttr in VB or System.IO.FileInfo.Attributes

or System.IO.File.SetAttributes()

.



Any algorithm that checks the last changed time or bit of the archive will depend on the number of directories on disk. Since both attributes are stored in the directory, the timing will depend on the file system and the level of caching. A more efficient way to analyze the effectiveness of a backup might be to view the number of changed blocks.

+2


source


May I suggest looking for "rsync for windows" on your favorite search engine?



+1


source


You cannot avoid scanning all files, but it is limited to reading directory sectors. It still takes a while for the middle drive. Besides the file date, there is an archive bit for each file entry. Remember to clear it after creating the file.

So the complexity will be O (n), where n is the number of files.

+1


source


Here's some very nice simple stuff that I use for backups in my scripts: http://www.mikerubel.org/computers/rsync_snapshots/ .

Based on this, the first approach would be to create a database of the modification times of the files and compare / update them each time you make a backup. Apart from datetime, I would also keep the file size and add it to the comparison.

0


source







All Articles