PoshCode Archive  Artifact [26292ca81f]

Artifact 26292ca81f1055da322f174500dfc99d2dd9cc402fb4c1a42d7a73b488003ca2:

  • File copy-data.ps1 — part of check-in [0f6d0271ef] at 2018-06-10 12:56:26 on branch trunk — Copy Data between Folders including a Progressbar (user: mazakane size: 672)

# encoding: ascii
# api: powershell
# title: copy-data
# description: Copy Data between Folders including a Progressbar
# version: 0.1
# type: function
# author: mazakane
# license: CC0
# function: copy-data
# x-poshcode-id: 1103
# x-archived: 2009-05-19T06:41:44
#
#
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 "Copyng Files" -Status $status -PercentComplete ($counter/$files.count * 100)
		Copy-Item $file.pspath $dest -Force
		$counter++
		}
}