mike7411 wrote:Is this a good way of doing it?
1. You want to check what happens if different drives are involved.
2. You want to verify paths are supported.
3. Catching one type of exception ignores possible other ones. Probably unlikely but in case.
mike7411 wrote:buffer sizes are being used behind the scenes?
There are all sorts of possible buffers. Disk, OS, library.
Only concern however for that is speed. You can profile it. You can also use a OS command shell call for comparison.
If it matters, at least in my experience, OS shell commands will always be faster. This is especially true when copying directories. Seems reasonable given that the copy operation in the OS doesn't involve loading the data into the application.
Even so if you need it to be 'fast' for some reason then I would suggest that you need to change your requirements/design. Copying files, in general, is always 'slow'. Speed doesn't matter for single small files. So only matters for very large files and/or large numbers of files. But those will always be 'slow'. And there can be error conditions that make it even slower (which your code does not account for.) So attempting to guarantee a speed rate is never going to work.