views:

1158

answers:

2

Robocopy is the best reliable and feature rich way to batch copy files on Windows. However, it is a command line tool.

I am looking for a library/API that I could do the same in my program. I tried to use Process.Start(), but then I have to capture and to parse stdout for progress bar and no way to the overwrite behavior.

For example, exclude file base on delegate function; rename file if it is older; (re)start copy based on some events.

I guess copy, xcopy, recursive copy and etc, should be the most frequency wheel programmers do reinvent. Are there any API/library I missed?

+2  A: 

There seems to be some stuff out there which puts a GUI on it, e.g. Synchronizing Images and Files in Windows Vista and XP Using Microsoft SyncToy (forum here) and Utility Spotlight - Robocopy GUI. I haven't found an API as yet, nor whether Robocopy exposes ActiveX-style control.

Edit: The rather large online description of Robocopy says something about

Robocopy 'Jobs' and the 'MOnitor source' option provide an alternative to setting up a Scheduled Task to run a batchfile with a RoboCopy command.

Might help. Might not.

boost
A: 

Thanks for your answers, and after some more research, I believe the API does not exist.

The maximum degree of reusing the feature from Robocopy is fork a child process with command line arguments.

Dennis Cheung