ps/Modules/Alkami.PowerShell.Common/Public/Get-FilesNoSymlink.ps1
2023-05-30 22:51:22 -07:00

24 lines
508 B
PowerShell

function Get-FilesNoSymlink {
<#
.SYNOPSIS
Returns a recursive list of files without following symlinks.
#>
param(
$Path
)
$fc = new-object -com scripting.filesystemobject
$folder = $fc.getfolder($Path)
foreach ($file in $folder.files) { $file | Select-Object -ExpandProperty Path }
foreach ($subfolder in $folder.subfolders)
{
if ( (get-item $subfolder.path).Attributes.ToString() -notmatch "ReparsePoint")
{
Get-FilesNoSymlink($subfolder.path)
}
}
}