Anyone knwo how I can build an array of variables? As you can see I have INBOXFIND and INBOXMOVE but when I try to call them in my find it is giving me a directory not found error. The paths are correct to. Just not sure what I am doing wrong. I have never called an array of variables before.
SERVER72IN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/72/In/
SERVER72OUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/72/In/
LOCAL72IN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/72/In/
LOCAL72OUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/72/In/
SERVER2400IN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/2400/In/
SERVER2400OUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/2400/In/
LOCAL2400IN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/2400/In/
LOCAL2400OUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/2400/In/
SERVERADSENDIN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/Adsend/In/
SERVERADSENDOUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Server/Adsend/In/
LOCALADSENDIN=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/Adsend/In/
LOCALADSENDOUT=/Volumes/Macintosh\ HD/Users/distillers/Desktop/Local/Adsend/In/
LOGPATH=~/Desktop/
INBOXFIND=($SERVER72IN, SERVER2400IN, SERVERADSENDIN)
INBOXMOVE=($LOCAL72IN, LOCAL2400IN, LOCALADSENDIN)
######################################################
####################Start Shell#######################
for i in “${INBOXFIND[@]}”
do
find $i -type f ! -name “." | while read FN
do
# Check to see if file has finished copying…
X=lsof "$FN" | wc -l
if [ $X == 0 ]
#if [ $X -le 2 ]
then
case $1= in
[ $i == “${INBOXFIND[0]}” ]) mv “$FN” “${INBOXMOVE[0]}”
;;
[ $i == “${INBOXFIND[1]}” ]) mv “$FN” “${INBOXMOVE[1]}”
;;
[ $i == “${INBOXFIND[2]}” ]) mv “$FN” “${INBOXMOVE[2]}”
;;
esac
#if [ $? == 0 ]
#then
#printf "${FN##/}”\tmoved to zIn_Progress…\tdate +%b\ %d\ %y\ %H\:%M\:%S
\n" >>$LOGPATH
#fi
else
printf “${FN##*/}”\tis still copying…not moved to zIn_Progress yet…\tdate +%b\ %d\ %y\ %H\:%M\:%S
\n" >>$LOGPATH
fi
done
done
Thanks!!!