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