Skip to content

Instantly share code, notes, and snippets.

Created July 15, 2014 14:37
Show Gist options
  • Save anonymous/aad0254801c71ae79e71 to your computer and use it in GitHub Desktop.
Save anonymous/aad0254801c71ae79e71 to your computer and use it in GitHub Desktop.
$MAIN_DIR = "D:\Games\DF 0.40"
function Operation($choice) {
switch ($choice) {
'c' {
mv "$outdir\data\init\colors.txt" "$outdir\data\init\colors.txt.old"
cp "$indir\data\init\colors.txt" "$outdir\data\init\colors.txt"
}
's' {
mv "$outdir\data\save\*" "$outdir\data\init\oldsaves"
cp -Recurse "$indir\data\save\*" "$outdir\data\save\"
}
'b' {
$date = Get-Date
$dstring = $date.Year+"-"+$date.Month+"-"+$date.Day
mkdir "$outdir\$dstring"
cp -Recurse "$indir\data\save\*" "$outdir\$dstring"
}
}
}
function MainConsole() {
$count = 0
$dirs = Get-ChildItem -Directory $MAIN_DIR
Write-Host -back Black -fore Yellow 'Select input dir:'
foreach($dir in $dirs) {
Write-Host "$count) $($dir.Name)"
$count = $count + 1;
}
$indir = $dirs[$(Read-Host)].FullName
Write-Host -back Black -fore Yellow 'Select output dir:'
$outdir = $dirs[$(Read-Host)].FullName
$choice = ""
do {
Write-Host -back Black -fore Green "copy [c]olors.txt"
Write-Host -back Black -fore Green "copy [s]aves"
Write-Host -back Black -fore Green "[b]ackup saves"
Write-Host -back Black -fore Green "[q]uit"
$choice = Read-Host
Operation($choice)
} while ($choice -ne 'q');
}
MainConsole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment