-
Notifications
You must be signed in to change notification settings - Fork 12
/
Symlink.ps1
29 lines (26 loc) · 855 Bytes
/
Symlink.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
param (
[string]$SingleFolder = ""
)
$SMLPath = "C:\Code\SatisfactoryModLoader-1.0\Mods"
$ModDir = "C:\Code\SF\SatisfactoryMods"
function New-Sym-Link ($Link) {
Remove-Item ($SMLPath + "\" + $Link) -ErrorAction SilentlyContinue -Recurse
New-Item -Path ($SMLPath + "\" + $Link) -ItemType SymbolicLink -Value ($ModDir + "\" + $Link) -Force
}
if ($SingleFolder -ne "") {
$dir = Get-ChildItem $ModDir | Where-Object {$_.PSISContainer -and $_.Name -eq $SingleFolder}
if ($dir) {
Write-Output "Processing folder: $($dir.Name)"
New-Sym-Link $dir.Name
}
else {
Write-Output "Folder '$SingleFolder' not found."
}
}
else {
$dir = Get-ChildItem $ModDir | Where-Object {$_.PSISContainer}
foreach ($d in $dir) {
Write-Output "Processing folder: $($d.Name)"
New-Sym-Link $d.Name
}
}