mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Move to using Robocopy and the /mir flag
This commit is contained in:
@@ -1,47 +1,3 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install the module in the PowerShell module folder.
|
||||
$fullPath = 'C:\Program Files\WindowsPowerShell\Modules\ImportExcel'
|
||||
|
||||
.DESCRIPTION
|
||||
Install the module in the PowerShell module folder by copying all the files.
|
||||
#>
|
||||
|
||||
[CmdLetBinding()]
|
||||
Param (
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$ModuleName = 'ImportExcel',
|
||||
[ValidateScript({Test-Path -Path $_ -Type Container})]
|
||||
[String]$ModulePath = 'C:\Program Files\WindowsPowerShell\Modules'
|
||||
)
|
||||
|
||||
Begin {
|
||||
Try {
|
||||
Write-Verbose "$ModuleName module installation started"
|
||||
|
||||
$Files = Get-Content $PSScriptRoot\filelist.txt
|
||||
}
|
||||
Catch {
|
||||
throw "Failed installing the module '$ModuleName': $_"
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
Try {
|
||||
$TargetPath = Join-Path -Path $ModulePath -ChildPath $ModuleName
|
||||
|
||||
if (-not (Test-Path $TargetPath)) {
|
||||
New-Item -Path $TargetPath -ItemType Directory -EA Stop | Out-Null
|
||||
Write-Verbose "$ModuleName created module folder '$TargetPath'"
|
||||
}
|
||||
|
||||
Get-ChildItem $Files | ForEach-Object {
|
||||
Copy-Item -Path $_.FullName -Destination "$($TargetPath)\$($_.Name)"
|
||||
Write-Verbose "$ModuleName installed module file '$($_.Name)'"
|
||||
}
|
||||
|
||||
Write-Verbose "$ModuleName module installation successful"
|
||||
}
|
||||
Catch {
|
||||
throw "Failed installing the module '$ModuleName': $_"
|
||||
}
|
||||
}
|
||||
Robocopy . $fullPath /mir /XD .vscode .git examples testimonials images spikes /XF appveyor.yml .gitattributes .gitignore
|
||||
Reference in New Issue
Block a user