much tastier version of game saver, with function for the repetitive stuff.
[feisty_meow.git] / customizing / fred / scripts / gamesaver.sh
1 #!/bin/bash
2
3 # a helpful script that scrapes any active game saves from wine's storage
4 # area into a spooling saves folder for archiving.
5
6 WINE_SOURCE_DIR="$HOME/wine_goods/My Games"
7 SPOOLING_OUTPUT_DIR="$HOME/spooling_saves"
8
9 function line()
10 {
11   echo "======="
12 }
13
14 # copies the files for a particular game out to a spooling folder.
15 function copyem()
16 {
17   game_name="$1"; shift
18   source_dir="$1"; shift
19   out_dir="$1"; shift
20
21   if [ -d "$source_dir" ]; then
22     echo $game_name
23     cp -v -n "$source_dir"/* "$out_dir"/
24     line
25   fi
26 }
27
28 # make the output folders if they don't exist.
29 for i in skyrim fallout_new_vegas fallout_3 oblivion fallout4 ; do
30   if [ ! -d "$SPOOLING_OUTPUT_DIR/$i" ]; then
31     mkdir -p "$SPOOLING_OUTPUT_DIR/$i"
32   fi
33 done
34
35 # now run through and copy our save files from the potentially weird locations
36 # they reside in.
37
38 #hmmm: at least make a function out of those repetitive steps.  sheesh.
39
40 line
41
42 copyem "skyrim" "$WINE_SOURCE_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
43
44 copyem "fallout new vegas" "$WINE_SOURCE_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
45
46 copyem "fallout 3" "$WINE_SOURCE_DIR/Fallout3/Saves/Player1" "$SPOOLING_OUTPUT_DIR/fallout_3"
47
48 copyem "oblivion" "$WINE_SOURCE_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
49
50 copyem "fallout 4" "$WINE_SOURCE_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout4"
51
52