<s> """<STR_LIT>""" <EOL> import sys <EOL> import os , os . path <EOL> folders = [ [ "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] ] <EOL> def path_exists_and_not_empty ( path ) : <EOL> """<STR_LIT>""" <EOL> if os . path . exists ( path ) : <EOL> for root , dirs , file_names in os . walk ( path ) : <EOL> break <EOL> if len ( file_names ) > <NUM_LIT:0> or len ( dirs ) > <NUM_LIT:0> : <EOL> return True <EOL> return False <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> args = sys . argv <EOL> error = False <EOL> if len ( args ) == <NUM_LIT:2> : <EOL> media_dir = args [ <NUM_LIT:1> ] <EOL> else : <EOL> print "<STR_LIT>" % args [ <NUM_LIT:0> ] <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> if os . path . exists ( media_dir ) : <EOL> if not os . path . isdir ( media_dir ) : <EOL> print "<STR_LIT>" % media_dir <EOL> error = True <EOL> elif path_exists_and_not_empty ( media_dir ) : <EOL> print "<STR_LIT>" % media_dir <EOL> error = True <EOL> else : <EOL> print "<STR_LIT>" % media_dir <EOL> try : <EOL> os . mkdir ( media_dir ) <EOL> except Exception , e : <EOL> print "<STR_LIT>" % ( media_dir , str ( e ) ) <EOL> error = True <EOL> if not error : <EOL> print "<STR_LIT>" <EOL> for path_list in folders : <EOL> folder = os . path . join ( media_dir , os . path . join ( * path_list ) ) <EOL> print "<STR_LIT:U+0020>" , folder <EOL> try : <EOL> os . makedirs ( folder ) <EOL> except Exception , e : <EOL> print "<STR_LIT>" % ( folder , str ( e ) ) <EOL> print "<STR_LIT>" <EOL> else : <EOL> print "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:1> ) </s>
