24 lines
508 B
PowerShell
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)
|
|
}
|
|
}
|
|
}
|
|
|