Powering into RoboCopy with the PowerShell RoboCopy clone, RoboPowerCopy (which even includes Long Path support...)
RoboCopy is an EXE file and it has closed source. We (the customers) are not able to change it’s behavior. E.g. I’m missing a “verify” feature for years. Some people say: “It’s a copy tool not a backup tool”. Okay. That’s right. But I want to be sure that the copied data is valid and identical to the source data.
Because of that I thought about the possibility to realize a RoboCopy clone with PowerShell. – So I did it now.
RoboPowerCopy is plain PowerShell. No assemblies or PowerShell extensions are needed. – It uses some inline C# code.
RoboPowerCopy should “understand” at least the commands (options) of RoboCopy. – Currently I’ve implemented a lot of RoboCopy’s abilities. Not all. But some new features on top, e.g. verify and “read-and-check-before-copy”. “Verify” uses .NET hashing algorithms to compare the written data to the source data. If the destination file already exists the “Read-and-check-before-copy” feature reads every portion of data from the destination file before it replaces the data portion on the destination file with the source file’s data. This should reduce the time that is needed to copy large files that have only a few binary changes.
As you may now .NET has no build in capabilities to handle with very long paths with more than 256 characters. I have developed a set of helper classes in C# that enable RoboPowerCopy to deal with very long paths. - This C# is included in the script an will be compiled at runtime into an assembly in memory.
Here are the abilities:
- Long path support (!!)
- Restartable mode using a temporary “copy header” at the end of the copied file.
- Copy security: SACL, DACL, Owner
- Copy file attributes and timestamps
- Same option set as RoboCopy (not completely implemented)
- Can be extended because it’s open source
- Pure PowerShell with some inline C# code
- Compare file times as UTC
- Modify it on any Windows Operation System >= Win XP / Windows 2003 Server with Microsoft's PowerShell development tool Windows PowerShell Integrated Scripting Environment that is part of PowerShell.
These are the limitations:
- No multithreading support
- No “Job” files at the moment
- Slower than RoboCopy (Because RoboPowerCopy is Powershell and/based on Managed Code but RoboCopy is native optimized code…)
The following options I have implemented (v0.0.1.0). There are some options that are not available in RoboCopy. These I’ve marked red.
You had me a Long Path Support and written that it's completely in PowerShell... and has a nearly complete Robocopy feature set... and how the inline C# was used... and well, it's RoboCopy in PowerShell!
Related Past Post XRef:
Introduction of the BCL CodePlex project (code samples, previews, prototypes, etc from the BCL team) – Includes “Long Path” library direct from the BCL Team (think “Breaking out of MAX_PATH”)
The Long Path for the BCL Team
AlphaFS – Some Max_Path, Transactional NTFS, hard links, and more .Net System.IO.File/Path/Directory Help (alpha)
Unicode Path Fun...
Did you know that the Robocopy that with comes with Vista+ supports multithreaded copying?
Another Robocopy hotfix, this time to fix the skipping over of some files with some East Asian characters in their names...
Robocopy DACL issue on Win7/Win Server 2008 R2 and a Hotfix