<s> import os <EOL> import sys <EOL> """<STR_LIT>""" <EOL> def munge ( src_dir ) : <EOL> files = os . listdir ( src_dir ) <EOL> for fn in files : <EOL> base , ext = os . path . splitext ( fn ) <EOL> first = base [ : <NUM_LIT> ] <EOL> second = base [ : <NUM_LIT> ] <EOL> dst_dir = os . path . join ( '<STR_LIT>' , '<STR_LIT>' , first , second ) <EOL> if not os . path . exists ( dst_dir ) : <EOL> os . makedirs ( dst_dir ) <EOL> src = os . path . join ( src_dir , fn ) <EOL> dst = os . path . join ( dst_dir , fn ) <EOL> print '<STR_LIT>' . format ( src , dst ) <EOL> os . rename ( src , dst ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> src_dir = sys . argv [ <NUM_LIT:1> ] <EOL> munge ( src_dir ) </s>
