# finde alle symbolic links, junctions, Reparse Points im NTFS Dateisystem
# Reparse Points können sein: Hardlinks, Junctions und Symlinks (Softlinks)

# siehe ct 05/2023 , "Du willst hier nicht rein"
Beispiele, bei denen dieses Attri­but zum Einsatz kommt,
sind Platzhalter für Dateien in Ihrem OneDrive,
die nur auf dem Server, aber nicht lokal auf Ihrem Rechner liegen,
und deduplizierte Dateien.


    <JUNCTION> = Junction point to folder (directory)
    <SYMLINK> = Symbolic link to file
    <SYMLINKD> = Symbolic link to folder (directory)

# Reparse Points = Analysepunkte, Grundlage für symbolische Links, Verzeichnisverknüpfungen (Junctions) und Speicherplatz-Einsparungen wie OneDrive Placeholder
# https://learn.microsoft.com/de-de/windows-hardware/drivers/ifs/reparse-points


# cmd NICHT als Administrator
# zeige alle Links für Laufwerk C:
dir /AL /S C:\

# zeige alle Symbolischen Links für Laufwerk C:,
dir /AL /S C:\ | find "SYMLINK"

# zeige alle Junctions für Laufwerk C:,
dir /AL /S C:\  | find "<JUNCTION>"

# zeige alle Arten von Links für Laufwerk C:
dir /AL /S C:\ | find "<"

# Beispiele
<SYMLINKD> All Users [C:\ProgramData]
<JUNCTION>  Default User [C:\Users\Default]


# https://blog.davidvarghese.net/posts/windows-links-demystified/
# Powershell NICHT als Administrator
# finde symbolic links
Get-ChildItem -Path "C:\" -Recurse -ErrorAction 'silentlycontinue' | Where-Object { $_.LinkType -eq 'SymbolicLink' }

# finde Junctions
Get-ChildItem -Path "C:\" -Recurse -ErrorAction 'silentlycontinue'| Where-Object { $_.LinkType -eq 'Junction' }

# finde broken junctions
Get-ChildItem -Path "C:\" -Recurse -ErrorAction 'silentlycontinue' | Where-Object { $_.LinkType -eq 'Junction' -and -not (Test-Path $_.Target)}

# finde alle Arten von Links / ReparsePoints
Get-ChildItem -Path "C:\" -recurse -force -ErrorAction 'silentlycontinue' | Where-Object { $_.Attributes -match "ReparsePoint" }

Feld 'Mode'
- `l` (link)
- `d` (directory)
- `a` (archive)
- `r` (read-only)
- `h` (hidden)
- `s` (system)

# https://mikemstech.blogspot.com/2012/10/windows-symbolic-links-and-file-sharing.html
# normales Verhalten bei Symlinks
fsutil behavior query SymlinkEvaluation

# Weiter Programme zum Auffinden von Hardlinks, Junctions und Symlinks:
# Nirsoft: NTFSLinksView
https://www.nirsoft.net/utils/ntfs_links_view.html
# sysinternals: FindLinks
https://learn.microsoft.com/de-de/sysinternals/downloads/findlinks
# Uwe Sieber: ListLinks
https://www.uwe-sieber.de/filetools.html