#!/bin/sh # # MOVERS - Uses a given file to move a set of files to another directory. if [ -n "$1" ] then if [ -n "$2" ] then if [ -f $1 ] then if [ "$1" = ".descs" ] then echo "" echo "No!!!! Don't use the .descs file! That screws things up!" echo "Exiting..." echo "" else echo "" echo "[/] Using $1 as the data file...." if [ -d $2 ] then echo "[/] Files will be moved to $2...." echo "" echo "[\] Moving files...." for each in `cut -d' ' -f1 $1` do if [ -f $2/$each ] then echo "[!] Oops! There's already a $each in $2. Staying put." echo "There: `ls -l $2/$each`" echo "Here: `ls -l $each`" else mv $each $2 fi done echo "[\] Files moved. Now appending $1 to $2/.descs..." cat $1 >>$2/.descs echo "[\] Appended. Deleting $1." rm $1 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 fi else echo "" echo "[/] File $1 does NOT exist! Exiting." echo "" fi else echo "Arguments am: .movers " fi else echo "Arguments are: .movers " fi