def cleanHdfsDirs(): cleancall = "hadoop fs -rmr %s/*" % (HDFS_ADA_DIR) print "Cleaning adaclass dir with command %s" % (cleancall) if SynchUtil.promptOkay("Okay to delete? "): os.system(cleancall) else: print "Okay, quitting" sys.exit(1)
hdfsdir = sys.argv[1] ftypemap = {} for onefile in os.listdir("."): ftoks = onefile.split(".") if not len(ftoks) == 2: continue basename = ftoks[0] ftype = ftoks[1] ftypemap.setdefault(ftype, 0) ftypemap[ftype] += 1 for ftype in ftypemap: print "Found %d files of type %s" % (ftypemap[ftype], ftype) if not SynchUtil.promptOkay("Going to upload files to %s" % (hdfsdir)): sys.exit(1) for onefile in os.listdir("."): upcall = "hadoop fs -put %s %s" % (onefile, hdfsdir) print "Upload call is %s" % (upcall) os.system(upcall)