Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

Shell? CYGWIN? EP-Macro? This is 2015!

python>>

for i in [f in listdir('.') if f[-len('.idf'):] == '.idf']:
   for w in [f in listdir('.') if f[-len('.epw'):] == '.epw']:
      call(["EnergyPlus -p %s -w %s %s" % (i[:-len('.idf')] + '_' + w[:-len('.epw')], w, i)])

Good night, drive home safely!

Shell? CYGWIN? EP-Macro? This is 2015!

python>>

for i in [f in listdir('.') if f[-len('.idf'):] == '.idf']:
glob('*.idf')]:
   for w in [f in listdir('.') if f[-len('.epw'):] == '.epw']:
glob('*.epw')]:
      call(["EnergyPlus -p %s -w %s %s" % (i[:-len('.idf')] + '_' + w[:-len('.epw')], w, i)])

Good night, drive home safely!

Shell? CYGWIN? EP-Macro? This is 2015!

python>>

for i in [f in glob('*.idf')]:
glob('*.idf'):
   for w in [f in glob('*.epw')]:
glob('*.epw'):
      call(["EnergyPlus -p %s -w %s %s" % (i[:-len('.idf')] + '_' + w[:-len('.epw')], w, i)])

Good night, drive home safely!

PS Thanks to @scottb for pointer to 'glob' (basically a 'listdir' with regular expressions, like a shell 'ls')!

Shell? CYGWIN? EP-Macro? This is 2015!

python>>

for i in glob('*.idf'):
   for w in glob('*.epw'):
      call(["EnergyPlus subprocess.call(["EnergyPlus -p %s -w %s %s" % (i[:-len('.idf')] + '_' + w[:-len('.epw')], w, i)])

Good night, drive home safely!

PS Thanks to @scottb for pointer to 'glob' (basically a 'listdir' with regular expressions, like a shell 'ls')!