updated to include witcher
[feisty_meow.git] / scripts / customize / fred / scripts / games / 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 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
7
8 WINE_GOODS_DIR="$HOME/wine_goods"
9 WINE_SOURCE_DIR="$WINE_GOODS_DIR/My Games"
10 SPOOLING_OUTPUT_DIR="$HOME/data/spooling_saves"
11
12 if [ ! -d "$WINE_SOURCE_DIR" ]; then
13   WINE_SOURCE_DIR="/cygdrive/c/users/fred/My Documents/My Games"
14 fi
15 if [ ! -d "$WINE_SOURCE_DIR" ]; then
16   echo "Failing to find the game save directories."
17   exit 1
18 fi
19
20 if [ ! -d "$SPOOLING_OUTPUT_DIR" ]; then
21   mkdir -p "$SPOOLING_OUTPUT_DIR"
22   exit_on_error Creating spooling output directory.
23 fi
24
25 # copies the files for a particular game out to a spooling folder.
26 function copyem()
27 {
28   game_name="$1"; shift
29   source_dir="$1"; shift
30   out_dir="$1"; shift
31
32   if [ -d "$source_dir" ]; then
33     echo $game_name
34     netcp "$source_dir"/* "$out_dir"/
35     sep 28
36   fi
37 }
38
39 # make the output folders if they don't exist.
40 for i in skyrim fallout_new_vegas fallout_3 oblivion fallout_4 ; do
41   if [ ! -d "$SPOOLING_OUTPUT_DIR/$i" ]; then
42     mkdir -p "$SPOOLING_OUTPUT_DIR/$i"
43   fi
44 done
45
46 # now run through and copy our save files from the potentially weird locations
47 # they reside in.
48
49 sep 28
50
51 copyem "skyrim" "$WINE_SOURCE_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
52
53 copyem "fallout new vegas" "$WINE_SOURCE_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
54
55 copyem "fallout 3" "$WINE_SOURCE_DIR/Fallout3/Saves" "$SPOOLING_OUTPUT_DIR/fallout_3"
56
57 copyem "oblivion" "$WINE_SOURCE_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
58
59 copyem "fallout 4" "$WINE_SOURCE_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout_4"
60
61 copyem "witcher 3" "$WINE_GOODS_DIR/The*Witcher*3/gamesaves" "$SPOOLING_OUTPUT_DIR/witcher_3"
62
63