#!/bin/bash

time=$1

echo "data time is "${time}

year=${time:0:4}

month=${time:4:2}

day=${time:6:2}

canDir=/spark/farm_can/

canMonthDir=${canDir}${year}"/"${month}

hadoop fs -test -e ${canMonthDir}

if [ $? -ne 0 ] ; then
  hadoop fs -mkdir ${canMonthDir}
fi

canDirDay=${canDir}${year}"/"${month}"/"${day}

echo "can dir is "${canDir}

hadoop fs -test -e ${canDirDay}

if [ $? -ne 0 ] ; then
  hadoop fs -mkdir ${canDirDay}
fi
