#!/bin/sh
#
# MOVE - Single-file version of Movers.

if [ -n "$1" ]
   then

   if [ -n "$2" ]
      then
      
      if [ -f $1 ]
         then 
   
            echo ""
            echo "[/] Using $1 as the data file...."
    
            if [ -d $2 ]
               then
               echo "[/] $1 will be moved to $2...."

               echo ""
               echo "[\] Moving file...."

                   if [ -f $2/$1 ]
                      then
                      echo "[!] Oops! There's already a $1 in $2. Staying put."

# Comment When Not In the Mood

echo "    The Difference is...."

                      diff -btw $2/$1 $1

                      echo "There: `ls -l $2/$1`"
                      echo "Here: `ls -l $1`"

                      echo "Do you want to delete the file in this directory? (y/n)"
                      read INPUT
                      if [ "$INPUT" = "y" ]
                          then
                          echo "OK, into the shitbin..."
                          rm $1
                      fi 
                      else
                      mv $1 $2
                      touch $2/$1
                      echo "[\] File moved. Now appending $1 to $2/.descs..."
                      grep $1 .descs >>$2/.descs
       
                      echo "[\] Now updating both affected directories."
    
                      if [ "$3" = "nolocal" ]
                         then
                         echo "[\] Skipping the local update..."
                         else
                         echo "[\] First this one...."
                         /textfiles/ferret
                      fi
                      echo "[\] Now that one."

                      cd $2
              
                      /textfiles/ferret
    
                      echo "[/] Files successfully transferred."
                      echo ""
                   fi
               else
               echo "[/] There is no such directory as $2! Exiting."
               echo ""
             fi
         else
         echo ""
         echo "[/] File $1 does NOT exist! Exiting."
         echo ""
      fi
      else
      echo "Arguments am: .move <File> <Directory>"
   fi
   else
   echo "Arguments are: .move <File> <Directory>"
fi

