Skip to content

cdhunt/Qopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Qopy

A Quick Powershell File Copy Module with CRC Check.

XCopy, Robocopy and Teracopy are all good Windows utilities for copying a large amount of files, but none of them offer easily machine-readable results report. An efficient, reliable and audit-able copy utility is critical for large-scale, automated software deployments.

Qopy is a binary Powershell Module that provides some the functionality of all of those other utilities with an object output for advanced reporting and auditing. Qopy copies only the data inside each file and none of the metadata like ModifiedTime or ACLs.

Two Cmdlets are exported.

NAME
	Copy-Files

SYNOPSIS
	A Powershell File Copy Module with CRC Check.

SYNTAX
	Copy-Files [-Source] <string> [-Destination] <string> [[-Filter] <string>]
	[[-Recurse]] [[-SetTime]] [[-Overwrite]] [[-ShowProgress]]  [<CommonParameters>]


NAME
	Get-CopyResultsReport

SYNOPSIS
	Aggregate output of Copy-Files

SYNTAX
	Get-CopyResultsReport -InputObject <FileCopyResultsItem>
	[<CommonParameters>]		

The output is an object list with the following properties�One object per source file.

   TypeName: Qopy.FileCopyResultsItem

Name           MemberType Definition
----           ---------- ----------
Destination    Property   string Destination {get;set;}
DestinationCRC Property   string DestinationCRC {get;set;}
ErrorMessage   Property   string ErrorMessage {get;set;}
Match          Property   bool Match {get;set;}
Size           Property   long Size {get;set;}
Source         Property   string Source {get;set;}
SourceCRC      Property   string SourceCRC {get;set;}
Time           Property   timespan Time {get;set;}

Get-CopyResultsReport returns the following properties.

TypeName: Qopy.FileCopyResultsReport

Name           MemberType Definition
----           ---------- ----------
Bytes          Property   long Bytes {get;set;}
FailedItemList Property   System.Collections.Generic.List[Qopy.FileCopyResultsItem]
FileCount      Property   int FileCount {get;set;}
TotalTime      Property   timespan TotalTime {get;set;}	

Features

  • Attempts to not copy files when unnecessary.
    • If file size is different and Overwrite switch is not enabled, do not copy.
    • If file size is the same and CRC check is the same, do not copy.
  • Validates source and destination contents match

CRC-32 functionality was developed by Damien Guard - Calculating CRC-32 in C# and .NET

Performance

Test Case: 1,797 Files in 145 Folders 108MB

Local System
TeraCopy w/Test 1:01
Qopy 0:27

LAN
TeraCopy w/Test 2:02
Qopy 1:31

Changes

1.0.3

  • Added the SetTime switch to copy timestamp metadata. This increases copy time by as much as 300%.

1.0.2

  • Changed error output to use WriteVerbose. This prevents terminating errors. Add the -Verbose switch to expose.
  • Added ErrorMessage property to the FileCopyResultsItem class to capture copy errors.

1.0.1

  • Removed some unnecessary IO by eliminating redundant file existence checks. Should improve network file copy performance a little bit.

Todo

  • A bunch of code clean-up
  • Update Progress bar to use Bytes instead of File Count
  • Move (delete source)?
  • Validate only?
  • Do not Validate?

Use

Requires Powershell v3.

Binary Download

  1. Extract to C:\Users\[username]\Documents\WindowsPowerShell\Modules
  2. Import-Module Qopy

If you use the ShowProgress switch without capturing the Output, the screen will get very flashy.

About

A Powershell File Copy Module with CRC Check

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages