import platform import re import os def filename2os_fname( fname ): # filename2os_fname translate Win or Linux fname to OS dependent style # takes in account the notion of 'Z:' drive on different systems # Z:\dir1\dir2\file <==> /mnt/qol_grp_data/dir1/dir2/file if platform.system() == 'Windows': fname = re.sub('/mnt/qol_grp_data', 'Z:', fname) else: fname = re.sub('Z:', '/mnt/qol_grp_data', fname) fname = re.sub(r'\\', '/', fname) fname = os.path.normpath(fname) return (fname) def get_runnum(savepath): # For the provided datapath: # reads, increments data counter and saves it back. # If nesessary creates counter file and full path to it. # example # get_runnum('Z:\Ramsi_EIT\data\') # get_runnum('/mnt/qol_grp_data/data') pass def get_next_data_file(prefix, savepath): run_number = get_runnum( savepath )