Created
July 8, 2023 15:22
-
-
Save Hashbrown777/47e1b1bb45b74cf899de279df8381109 to your computer and use it in GitHub Desktop.
free up space on my c drive
This file contains 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
cd $env:LOCALAPPDATA | |
( | |
'Ubisoft*', | |
'Grip', | |
'Evil*', | |
'ride3', | |
'Squad*', | |
'Remnant', | |
'Mordhau', | |
'Dead*', | |
'Rockstar*', | |
'Gas *', | |
'Dungeon*', | |
'Chivalry*', | |
'Space*', | |
'mxgp5', | |
'GOG*', | |
'FLiNG*', | |
'Back4*', | |
'Rocket*', | |
'SpeedF*' | |
) | gi | &{ Param($to) | |
Begin { | |
$to = $to | Get-Item -ErrorAction Stop | |
if ($to -isnot [System.IO.DirectoryInfo]) { throw $to.FullName } | |
$to = $to.FullName -replace '(?<!\\)$','\' | |
} | |
Process { | |
if (($_ | Get-Item -ErrorAction SilentlyContinue).Count -eq 1) { | |
$_ = $_ | Get-Item | |
} | |
else { | |
$_ = Get-Item -LiteralPath $_ -ErrorAction Stop | |
} | |
if (($_.Parent, $_.Directory).FullName -ne $PWD) { | |
throw ($_.Parent, $_.Directory).FullName | |
} | |
$_ | Move-Item -ErrorAction Stop -Destination $to | |
$_ = $_.Name | |
New-Item -type Junction -name $_ -value "$to$_" -ErrorAction Stop | |
} | |
} 'D:\Hashbrown\LocalAppData' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment