# I would like to use a simple copy by Copy-Item , but criteria is to exclude a big folder while copying named "Virtual Machines":
C:\Users\R2D2\Documents -destination F:\Backup\Docs -exclude C:\Users\R2D2\Documents\"Virtual Machines" -recurse -verbose
# I tried Copy-Item with -exclude parameter, but somehow only robocopy could use well exclude (/XD) to copy.
C:\Users\R2D2\Documents F:\Backup\Docs /E /XD C:\Users\R2D2\Documents\"Virtual Machines" /LOG+:"C:\Temp\robolog.txt"
# Do you think I have to use Robocopy for this sort of copy tasks? Or just missed something from my Copy-Item example?
# Thanks in advance
If you have robocopy available on your system, which is pretty much every system nowadays. Then I would definitely recommend using robocopy. It has all the switches built-in which you would otherwise have to script. Allows for retrying in case of network failure, has extensive logging capabilities and only copies the changed files along with many other benefits. This is a case of using the right kind of tool for the job, for most (bigger) file copy operations I would definitely use robocopy over copy-item any day.
Thanks. So I Won't substitute robocopy for Copy-Item, altough Copy-Item seems to be a nice commandlet.
I will use robocopy, but if it is needed I'll put robocopy in PowerShell script.
There are plenty of situations where copy-item is a good option as well. But depending on the feature set robocopy can be a better choice. Also it isn't limited by 248/260 path limitations that you might run into with Copy-Item.
I have used other softwrares like Robocopy, Teracopy and others but they failed at some point or other. So after searching a lot I found GS Richcopy. And this was the end of all my problems! It was easy to use unlike Robocopy, it provided long path name support unlike teracopy, it utilises all the cores of the CPU through its multi threaded file transfer unlike other software. This is the best that I have seen so far. I am using its enterprise version, its affordable according to the features they provide!