#
# Dependencies of this sub-command
#
rmdir_n_depends()
{
	echo ""
}

#
# Sub-command: systest::gfarm2fs::rmdir_n
#
subcmd_rmdir_n()
{
	log_debug "subcmd_rmdir_n"

	check_argc $# 2
	check_hostid any $HOSTID
	exec_remote_host_agent $HOSTID - systest::gfarm2fs::rmdir_n "$@"
	[ $? -ne 0 ] && log_error "gfservice systest::gfarm2fs::rmdir_n failed"

	log_debug "end subcmd_rmdir_n"
}

#
# Dependencies of this sub-command agent
#
rmdir_n_agent_depends()
{
	echo ""
}

#
# Sub-command: systest::gfarm2fs::rmdir_n
# Remove directories in target dir.
#
subcmd_rmdir_n_agent()
{
	DIR_PREFIX=$1
	NUM_DIRS=$2
	log_debug "subcmd_rmdir_n_agent DIR_PREFIX=$1 NUM_DIRS=$2"

	for I in `seq $NUM_DIRS`; do
		DIR=`printf $DIR_PREFIX%04d $I`
		if [ -d $DIR ]; then
			rmdir $DIR
			[ $? -ne 0 ] && log_error "failed to rmdir $DIR"
		fi
	done

	log_debug "end subcmd_rmdir_n_agent"
}
