2 # ---------------------------------------------------------------------------
3 # Multi-Phasic Applications: SquirrelJME
4 # Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 # Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
6 # ---------------------------------------------------------------------------
7 # SquirrelJME is under the GNU General Public License v3+, or later.
8 # See license.mkd for licensing and copyright information.
9 # ---------------------------------------------------------------------------
10 # DESCRIPTION: Moves a directory from one location to another within fossil,
11 # potentially merging them
16 # Directory of this script
17 __exedir
="$(dirname -- "$0")"
22 echo "Usage: $0 [-x] (src) (dest)" 1>&2
23 echo " -x Do nothing, just print what would be done."
28 while getopts "x" __arg
43 shift $
(($OPTIND - 1))
52 # Read source and destination as absolute paths so it can handle recursive
54 __src
="$("$__exedir/absolute.sh
" "$1")"
55 __dest
="$("$__exedir/absolute.sh
" "$2")"
57 # Need to cut characters from the source path so it is known where they are
58 __cut
="$(expr $(printf '%s' "$__src" | wc -m) + 2)"
60 # Go through each file in the source, only consider files
61 find "$__src" -type f |
while read __file
63 # Strip from the source to get the basepath
64 __abs
="$("$__exedir/absolute.sh
" "$__file")"
65 __basepath
="$(echo "$__abs" | cut -c "$__cut-")"
68 __target
="$__dest/$__basepath"
70 # Call other move script to handle this file
73 "$__exedir/fmv.sh" "-x" "$__abs" "$__target"
75 "$__exedir/fmv.sh" "$__abs" "$__target"