This utility is designed to backup a folder to another folder. It is not rocket science and not that interesting in terms of coding. However it can be useful if you want to copy your source from a machine to another or to make a quick backup. It will run a lot faster than a batch file if you repeat the command regularly.
How does this work
The program is very simple, it will copy only the files that were modified since the previous copy. It will always copy the subfolders and never ask any question. Any file or folder deleted from the source folder will also be deleted in the destination folder.
How to install
Just have to copy sync.exe into your windows\system32 folder.
How to run?
SYNC <source folder> <destination folder> in your DOS command prompt window or batch file.
This program despite being very simple is potentially lethal. Used with bad parameters, you can probably manage to erase your hard disk in no time at all. Use it only at your own risks.
Points of interest
Nothing very interesting in this program, this is a DOS utility not a code exploit. For each folder in the source tree, the utility gets a list of files and folders to copy to the destination. To avoid multiple lookups, the list of files in the destination folder are read once as well into a hash table. The program uses the
FileSystemInfo.LastWriteTimeUtc to compare the source and destination files. It then copies the new or modified files and deletes the files that were deleted since the last backup. Again be careful how you use this utility, the deletion does not ask any questions.
- 31st July 2005
st August 2005
- Force the copy when the files are read-only.
- Move to .NET framework 1 (was 2 so far).
Questions to readers
When I use the
IO.File.Copy method, the
FileSystemInfo.LastWriteTimeUtc is modified one or two seconds forward. Anyone knows how to make the date of last write to stay consistent from source to destination?