promotion of archival scripts to mainstream
[feisty_meow.git] / scripts / archival / compare_backup_drive.sh
1 #!/bin/bash
2
3 # compares the soapbox with the real archive to see if any older stuff might be
4 # left behind.  if it's got a less than in front, then it's only on the soapbox drive
5 # now rather than the pc's hard drive.
6
7 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
8
9 function compare_archives_with_target()
10 {
11   local target="$1"; shift
12
13   for currdir in $MAJOR_ARCHIVE_SOURCES; do
14     sep
15     echo "comparing '$currdir' with target '$target', where 'less thans' are on the target..."
16     compare_dirs "$target/$(basename $currdir)" "$currdir"
17   done
18 }
19
20 # decide which drive to compare.
21 targets="$1"
22 if [ -z "$targets" ]; then
23   targets=($($(which ls) -1 /media/$USERNAME))
24   if [ ${#targets[@]} -gt 1 ]; then
25     echo "
26 Please provide a media drive name on the command line, because more than
27 one possibility exists.
28 "
29   fi
30 fi
31
32 echo "comparing the media drive '${targets[0]}' against local archives."
33
34 compare_archives_with_target "/media/$USERNAME/${targets[0]}"
35
36 sep
37