Last active
July 21, 2019 14:03
-
-
Save zbalkan/7063d7533a0186bf9842aa3378db7d38 to your computer and use it in GitHub Desktop.
A simple function to export NTFS Alternate Data Streams (ADS) of a specified file as symbolic links.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Export-ADS (){ | |
[CmdletBinding()] | |
param ( | |
$Path | |
) | |
process { | |
Get-Item $Path -Stream * | | |
Select-Object -Property Stream -Skip 1 | | |
ForEach-Object { | |
$item = Get-Item $Path | |
[void] (New-Item -Path (Join-Path -Path $item.Directory -ChildPath "$($item.Name)_$($_.Stream)") -ItemType SymbolicLink -Value ("$($item.FullName):$($_.Stream)") -Force -Confirm:$false) | |
} | |
} | |
} | |
# Example | |
# Export-ADS -Path "test.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment