def alt_incvm(src, dst): """ CONW, ECLI を書き換えて出力する """ call("cat {0}/IN.CVM | sed 's/CONW=T/CONW=F/g' | " "sed 's/ECLI=T/ECLI=F/g' > tmp".format(src), shell=True) Bash.move('tmp', os.path.join(dst, "IN.CVM"))
def find_cif_files(path): """ This method find **.cif or **.cif.txt in path and path/cifs directory. All cif files are moved in path/cifs/ dirctory """ cifs_dir = os.path.join(path, 'cifs') Bash.mkdir(cifs_dir) search_cif = glob.glob(os.path.join(path, "*.cif")) search_ciftxt = glob.glob(os.path.join(path, "*.cif.txt")) search_cwd = search_cif + search_ciftxt for cif_file in search_cwd: Bash.move(cif_file, cifs_dir) search_cif = glob.glob(os.path.join(cifs_dir, "*.cif")) search_ciftxt = glob.glob(os.path.join(cifs_dir, "*.cif.txt")) search_cifs = search_cif + search_ciftxt if len(search_cifs) == 0: print('I cannot find any .cif file in {0} and {1}' .format(path, cifs_dir)) exit() return search_cifs