summaryrefslogtreecommitdiffstats
path: root/src/userscript.sh
blob: 3f7714b9f4eafa43ab3eeae104c64d329ca12916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

COVERNAMES="cover.jpg cover.png front.jpg front.png"

for COVERNAME in $COVERNAMES; do

  S_FILENAME=`echo "$1" | sed "s/^.*\///"`
  S_DIRECTORY=`echo "$1" | sed "s/$S_FILENAME//"`
  SOURCE=`ls "$S_DIRECTORY" | grep -F $COVERNAME`

  D_FILENAME=`echo "$2" | sed "s/^.*\///"`
  D_DIRECTORY=`echo "$2" | sed "s/$D_FILENAME//"`
  DESTINATION="$COVERNAME"

  if [ $SOURCE ]; then
#     echo "cp $S_DIRECTORY$SOURCE $D_DIRECTORY$DESTINATION"
    cp --update "$S_DIRECTORY$SOURCE" "$D_DIRECTORY$DESTINATION"
  fi

done

exit 0