Scripts to move config out of home directory

This commit is contained in:
John Doty 2014-11-05 05:52:43 -08:00
parent 5f2a27f9b8
commit 9a30a349fb
2 changed files with 24 additions and 0 deletions

1
setup.cmd Normal file
View file

@ -0,0 +1 @@
@powershell -ExecutionPolicy unrestricted %~dp0setup.ps1

23
setup.ps1 Normal file
View file

@ -0,0 +1,23 @@
function new-link($link, $target) {
if (test-path $target -PathType Container) {
cmd /c mklink /j $link $target
} else {
cmd /c mklink /h $link $target
}
}
$ignore = @(".gitignore", "setup.ps1")
Get-ChildItem . |
? { !$ignore.Contains($_.Name) } |
% {
$l = split-path -leaf $_.FullName
$p = split-path -parent (split-path -parent $_.FullName)
$t = join-path $p $l
if (test-path $t) {
remove-item -recurse -force $t
}
new-link $t $($_.FullName)
}