PoshCode Archive  Artifact [c270fb6a7d]

Artifact c270fb6a7d6e80076f27f5575f982af48537c496fa7b95def63711114f47580a:

  • File Coping-Files.ps1 — part of check-in [f63dc5ad55] at 2018-06-10 14:04:08 on branch trunk — Copy Data between Folders including a Progressbar (user: Glenn size: 713)

# encoding: ascii
# api: powershell
# title: Coping Files ...
# description: Copy Data between Folders including a Progressbar
# version: 0.1
# type: function
# author: Glenn
# license: CC0
# function: copy-data
# x-poshcode-id: 5921
# x-archived: 2015-07-10T13:26:58
# x-published: 2015-07-07T14:34:00
#
#
function copy-data {
	param($source, $dest)
	$counter = 0
	$files = Get-ChildItem $source -Force -Recurse
	foreach($file in $files)
		{
		$status = "Copying file {0} of {1}: {2}" -f $counter, $files.count, $file.name
		Write-Progress -Activity "Copying Files" -Status $status -PercentComplete ($counter/$files.count * 100)
		Copy-Item $file.pspath $dest -Force
		$counter++
		}
}