def run_unzip_file(conf: ConfigData, the_date: str): the_date = StrTool.get_the_date_str(the_date) if (type(the_date) is str) and len(the_date) == 8: m_month = the_date[0:6] m_day = the_date[6:8] else: return root_path = conf.get_data("allinpay_data_zc") destdir = conf.get_data("allinpay_data_zc") # ifile = '/home/testFolder/logflow/bl_shouyinbao/20181101/9999100000/t1_trxrecord_20181101_V2.csv' # ofile = '/home/testFolder/logflow/bl_shouyinbao/UTF8/20181101/9999100000/t1_trxrecord_20181101_V2.csv' print("Start\n") # os.path.join(root_path, the_date) # real SYB folder don't have date folder f_name = conf.get_zip_name(the_date, 3) # the_date+".zip" a_file = os.path.join(root_path, f_name) if MyLocalFile.check_file(a_file): MyLocalFile.unzip_the_file(a_file, destdir, p_name=the_date+"*") f_name = conf.get_zip_name(the_date,5) # the_date+"_agt.zip" a_file = os.path.join(root_path, f_name) if MyLocalFile.check_file(a_file): MyLocalFile.unzip_the_file(a_file, destdir, p_name=the_date+"*")
def run_unzip_file(conf: ConfigData, p_date: str): p_date = StrTool.get_the_date_str(p_date) if (type(p_date) is str) and len(p_date) == 8: m_month = p_date[0:6] m_day = p_date[6:8] else: return p_zip_path = os.path.join(conf.get_zip_path(), p_date) # root_path = conf.get_data("allinpay_data_zc") data_path = os.path.join(conf.get_data_path(), p_date) # allinpay_data_zc # ifile = '/home/testFolder/logflow/bl_shouyinbao/20181101/9999100000/t1_trxrecord_20181101_V2.csv' # ofile = '/home/testFolder/logflow/bl_shouyinbao/UTF8/20181101/9999100000/t1_trxrecord_20181101_V2.csv' print("Start\n") # os.path.join(root_path, the_date) # real SYB folder don't have date folder p_f_name = conf.get_zip_name( p_date) # 3= the_date+".zip" # 5 = the_date+"_agt.zip" p_a_file = os.path.join(p_zip_path, p_f_name) p_p_name = conf.get_file_name(p_date) # p_date+"*" if MyLocalFile.check_file(p_a_file): MyLocalFile.unzip_the_file(p_a_file, data_path, p_name=p_p_name)
def run_unzip_file(conf: ConfigData, the_date, folder_type=2): the_date = StrTool.get_the_date_str(the_date) if (type(the_date) is str) and len(the_date) == 8: m_month = the_date[0:6] m_day = the_date[6:8] else: return zip_path = conf.get_zip_path() data_path = conf.get_data_path() f_name = conf.get_zip_name("") # "t1_trxrecord_" the_date # "_V2.csv" print("Start\n") # os.path.join(root_path, the_date) # real SYB folder don't have date folder branches = MyLocalFile.get_child_dir(zip_path) for aBranch in branches: if MyLocalFile.check_branch(aBranch): months = MyLocalFile.get_child_dir(aBranch) for aMonth in months: the_month = MyLocalFile.check_month(aMonth) if the_month > 0 and "{:0>6d}".format(the_month) == m_month: day_list = MyLocalFile.get_child_dir(aMonth) for aDay in day_list: the_day = MyLocalFile.check_day(aDay) if the_day > 0 and "{:0>2d}".format(the_day) == m_day: files = MyLocalFile.get_child_file(aDay) for aFile in files: if MyLocalFile.check_file(aFile, p_name=f_name): short_name = os.path.basename(aBranch) if folder_type == 1: new_path = os.path.join( data_path, m_month, m_day, short_name) # "{:0>6d}".format(month) "{:0>2d}".format(day) else: new_path = os.path.join( data_path, m_month + m_day, short_name) # "{:0>6d}{:0>2d}".format(month, day) p_name = conf.get_file_name(m_month + m_day) MyLocalFile.unzip_the_file( aFile, new_path, p_name)
def run_unzip_file(configData: ConfigData): f_date_str = configData.get_f_date() # "20181101" zip_path = os.path.join(configData.get_zip_path(), f_date_str) # root_path = configData.get_data("allinpay_data_zc") data_path = os.path.join(configData.get_data_path(), f_date_str) # allinpay_data_zc # ifile = '/home/testFolder/logflow/bl_shouyinbao/20181101/9999100000/t1_trxrecord_20181101_V2.csv' # ofile = '/home/testFolder/logflow/bl_shouyinbao/UTF8/20181101/9999100000/t1_trxrecord_20181101_V2.csv' print("Start\n") # os.path.join(root_path, the_date) # real SYB folder don't have date folder f_name = configData.get_zip_name(f_date_str) # 3= the_date+".zip" # 5 = the_date+"_agt.zip" a_file = os.path.join(zip_path, f_name) p_name = configData.get_file_name(f_date_str) # p_date+"*" if MyLocalFile.check_file(a_file): MyLocalFile.unzip_the_file(a_file, data_path, p_name=p_name)