Click here to Skip to main content
14,765,693 members
Articles » Desktop Development » Files and Folders » Files
Posted 31 Jul 2005


70 bookmarked

Utility to backup your folders fast

Rate me:
Please Sign up or sign in to vote.
4.59/5 (23 votes)
31 Jul 2005
I use a procedure based on batch files to copy various versions of my project. I was a bit fed up to wait for the batch file to copy hundreads of files and wrote this small utility to speed up the process. I hope some of you will find it useful.

Sample Image - sync.png


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?

Just type 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
    • First release.
  • 1st 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?


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Pascal Ganaye
Software Developer (Senior)
France France
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

Comments and Discussions

GeneralConverted the code to C# and changed the date comparison to SHA CheckSum Pin
David Kittell23-Apr-13 7:55
MemberDavid Kittell23-Apr-13 7:55 
GeneralRe: Converted the code to C# and changed the date comparison to SHA CheckSum Pin
Pascal Ganaye26-Apr-16 8:42
MemberPascal Ganaye26-Apr-16 8:42 
GeneralMicrosoft's SyncToy Pin
Jalapeno Bob9-Sep-10 12:54
professionalJalapeno Bob9-Sep-10 12:54 
GeneralMy vote of 1 Pin
Yury300024-Aug-09 15:59
MemberYury300024-Aug-09 15:59 
GeneralRe: My vote of 1 Pin
Pascal Ganaye15-Sep-11 3:16
MemberPascal Ganaye15-Sep-11 3:16 
GeneralThanks! Pin
Tonny Vaes24-Aug-08 3:45
MemberTonny Vaes24-Aug-08 3:45 
QuestionConverting to c# Pin
chrisclarke1122-Mar-08 4:07
Memberchrisclarke1122-Mar-08 4:07 
AnswerRe: Converting to c# Pin
Pascal Ganaye15-Sep-11 3:20
MemberPascal Ganaye15-Sep-11 3:20 
Generalpeogram to copy to cd_we or usb Pin
syriast29-Jul-06 23:46
Membersyriast29-Jul-06 23:46 
GeneralRe: peogram to copy to cd_we or usb Pin
Pascal Ganaye30-Jul-06 8:58
MemberPascal Ganaye30-Jul-06 8:58 
GeneralRobocopy not so good Pin
Manuel JD Alves26-Feb-06 23:54
MemberManuel JD Alves26-Feb-06 23:54 
GeneralRobocopy seems faster Pin
anadem5-Aug-05 15:15
Memberanadem5-Aug-05 15:15 
GeneralRe: Robocopy seems faster Pin
Pascal Ganaye6-Aug-05 5:46
MemberPascal Ganaye6-Aug-05 5:46 
QuestionNice, but is this any better than &quot;robocopy&quot;? Pin
mikestrat3-Aug-05 4:10
Membermikestrat3-Aug-05 4:10 
AnswerRe: Nice, but is this any better than &quot;robocopy&quot;? Pin
david.price.dev3-Aug-05 9:48
Memberdavid.price.dev3-Aug-05 9:48 
GeneralRe: Nice, but is this any better than &quot;robocopy&quot;? Pin
Terence Wallace10-Aug-05 10:16
MemberTerence Wallace10-Aug-05 10:16 
GeneralRe: Nice, but is this any better than &quot;robocopy&quot;? Pin
david.price.dev10-Aug-05 11:15
Memberdavid.price.dev10-Aug-05 11:15 
GeneralRe: Nice, but is this any better than &quot;robocopy&quot;? Pin
cornejoserrano12-Sep-05 23:14
Membercornejoserrano12-Sep-05 23:14 
GeneralRe: Nice, but is this any better than &quot;robocopy&quot;? Pin
raviaw23-Feb-06 10:40
Memberraviaw23-Feb-06 10:40 
GeneralDestination issues with +/-RW media. Pin
Mike Whitenton2-Aug-05 22:56
MemberMike Whitenton2-Aug-05 22:56 
QuestionAnyone understand this bug ? Pin
Pascal Ganaye1-Aug-05 2:09
MemberPascal Ganaye1-Aug-05 2:09 
AnswerRe: Anyone understand this bug ? Pin
umeca741-Aug-05 8:22
Memberumeca741-Aug-05 8:22 
GeneralRe: Anyone understand this bug ? Pin
Pascal Ganaye1-Aug-05 8:46
MemberPascal Ganaye1-Aug-05 8:46 
This is what I call a documented answer... !

So far I empirically found that a file with a last modification date of 10:00:00.000 AM, will end up copied with a date time between 10:00:00.000 AM and 10:00:01.999 AM.
In other words, most of the time the files have precisely the same modification time but sometime up to two seconds were added (but never substracted).

Now if I read your M$ article, the date of modification is what they call write time.
It seems to confirm my assumption of 2 seconds.
It doesn't say which way it is though.

Do you think I should revert the default back to 2 second in both ways (either added or substracted) ?

GeneralRe: Anyone understand this bug ? Pin
John M. Drescher1-Aug-05 11:58
MemberJohn M. Drescher1-Aug-05 11:58 
AnswerRe: Anyone understand this bug ? Pin
John M. Drescher1-Aug-05 8:34
MemberJohn M. Drescher1-Aug-05 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.