Changeset 1473 in lmdz_wrf


Ignore:
Timestamp:
Mar 28, 2017, 11:20:52 PM (8 years ago)
Author:
lfita
Message:

Getting the right shel instruction for listing in `files_folder_HMT', cautino some results might change in other functions !!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1464 r1473  
    61446144        quit()
    61456145
    6146 #    ins = folder + "/" + head + "*" + middle + '*' + tail
    6147     ins = folder + "/"
    6148 #    print 'ins:',ins
    6149     files = sub.Popen(["/bin/ls","-1",ins], stdout=sub.PIPE)
     6146    # FROM: http://stackoverflow.com/questions/9997048/python-subprocess-wildcard-usage
     6147    ins = folder + "/" + head + "*" + middle + '*' + tail
     6148    #ins = folder + "/"
     6149    #files = sub.Popen(["/bin/ls","-1R",ins], shell=True, stdout=sub.PIPE)
     6150    files = sub.Popen("/bin/ls -1R " + ins, shell=True, stdout=sub.PIPE)
    61506151    fileslist = files.communicate()
    61516152    listfiles0 = str(fileslist).replace("'",'').replace('(','').replace(')','').split('\\n')
     
    61546155    listfiles = []
    61556156    for ifile in listfiles0:
     6157        print 'file:', ifile, '<>', ifile.find(head) != -1 and  ifile.find(middle) != -1 and ifile.find(tail) != -1
    61566158        if ifile.find(head) != -1 and  ifile.find(middle) != -1 and                  \
    61576159          ifile.find(tail) != -1:
Note: See TracChangeset for help on using the changeset viewer.