#!/bin/bash if [ "$#" != "1" ] ; then echo "Usage: $0 top-level-dir" exit fi toplevel_dir=$1 for d in /data/features/ef-full/$toplevel_dir/*/* ; do sub_dir=${d##/data/features/ef-full/} echo "Processing: $sub_dir" hdfs dfs -mkdir -p "full-ef-json-files/$sub_dir" into_dir=${sub_dir%/*} hdfs dfs -put $d "full-ef-json-files/$into_dir/." done