30 lines
585 B
PowerShell
30 lines
585 B
PowerShell
function Get-RelativeFileList {
|
|
<#
|
|
.SYNOPSIS
|
|
Returns a list of file names minus the base path.
|
|
#>
|
|
[CmdletBinding()]
|
|
Param (
|
|
[Parameter(Mandatory=$false)]
|
|
[string]$path = ".\",
|
|
[Parameter(Mandatory=$false)]
|
|
[string]$exclude = ""
|
|
)
|
|
|
|
$files = (Get-FilesNoSymlink $path)
|
|
|
|
# Trim the base path off.
|
|
$results = @()
|
|
$basePath = (Get-Item -path $path).FullName
|
|
$basePathSubstringLength = ($basePath.length + 1) # +1 gets leading slash.
|
|
$files | ForEach-Object {
|
|
if($_ -notlike $exclude)
|
|
{
|
|
$results += $_.substring($basePathSubstringLength)
|
|
}
|
|
}
|
|
|
|
return $results
|
|
}
|
|
|