PoshCode Archive  Artifact [8f1371a671]

Artifact 8f1371a671f007a85d2a46ed96f196f34c499bb811a9b8092443d63a7d1d26ce:

  • File copy-data.ps1 — part of check-in [c099fcf2e0] at 2018-06-10 13:32:02 on branch trunk — Copy Data between Folders including a Progressbar (user: unknown size: 2139)

# encoding: utf-8
# api: powershell
# title: 
# description: Copy Data between Folders including a Progressbar
# version: 0.1
# type: script
# license: CC0
# function: copy-data
# x-poshcode-id: 3841
# x-archived: 2012-12-28T07:35:49
#
#
################################################################################################################

#
# NAME
#     Copy-Data
#
# SYNOPSIS
#     Copy Data between Folders including a Progressbar
#
# SYNTAX
#     Copy-Data [Source <PathToSource>] [Destination <PathToDestination>] [-Confirm] [-Recurse]
#     
#
# DETAILED DESCRIPTION
#	The Copy-Data cmdlet copies an item from one location to another in a namespace. Copy-Data does not	

#	delete 	the items being copied.
#
# PARAMETERS
#     -Confirm <SwitchParameter>
#         Prompts you for confirmation before executing the command.
#
#         Required?                    false
#         Position?                    named
#         Default value                
#         Accept pipeline input?       false
#         Accept wildcard characters?  false
#
#     -Recurse <SwitchParameter>
#         Specifies a recursive copy.
#
#         Required?                    false
#         Position?                    named
#         Default value                
#         Accept pipeline input?       false
#         Accept wildcard characters?  false
#
#
# INPUT TYPE
#     
#
# RETURN TYPE
#     Shows a progressbar where you can see the progress
#
# NOTES
#
#	-------------------------- EXAMPLE 1 --------------------------
#   
#   C:\PS>copy-Data C:\Wabash\Logfiles\mar1604.log.txt C:\Presentation
#
#
#
#	-------------------------- EXAMPLE 2 --------------------------
#   
#   C:\PS>copy-Data C:\Wabash\Logfiles\*.txt C:\Presentation


function copy-data {
	param(
		[string]$file = "",
		[string]$dest = "",
		[switch]$Recurse,
		[switch]$Confirm
	)
		
$copy = cp $file $dest
for ($a=1; $a -lt 100; $a++) {
Write-Progress -Activity “Copying...” -SecondsRemaining $a -Status "% Complete:" -percentComplete $a
}
}


set-Alias cpd copy-data