#!/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."
                      echo "There: `ls -l $2/$1`"
                      echo "Here: `ls -l $1`"
                      else
                      mv $1 $2
                   fi

               echo "[\] File moved. Now appending $1 to $2/.descs..."

               grep $1 .descs >>$2/.descs
       
               echo "[\] Now updating both affected directories."
    
               echo "[\] First this one...."

               /textfiles/ferret
 
               echo "[\] Now that one."

               cd $2
              
               /textfiles/ferret
    
               echo "[/] Files successfully transferred."
               echo ""

               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

