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