def ldirectory(inpath, outpath, args, scope):
yacctab = '<STR_LIT>' if args.debug else None<EOL>if not outpath:<EOL><INDENT>sys.exit("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>if not os.path.isdir(outpath):<EOL><INDENT>if args.verbose:<EOL><INDENT>print("<STR_LIT>" % outpath, file=sys.stderr)<EOL><DEDENT>if not args.dry_run:<EOL><INDENT>os.mkdir(outpath)<EOL><DEDENT><DEDENT><DEDENT>less = glob.glob(os.path.join(inpath, '<STR_LIT>'))<EOL>f = formatter.Formatter(args)<EOL>for lf in less:<EOL><INDENT>outf = os.path.splitext(os.path.basename(lf))<EOL>minx = '<STR_LIT>' if args.min_ending else '<STR_LIT>'<EOL>outf = "<STR_LIT>" % (outpath, outf[<NUM_LIT:0>], minx)<EOL>if not args.force and os.path.exists(outf):<EOL><INDENT>recompile = os.path.getmtime(outf) < os.path.getmtime(lf)<EOL><DEDENT>else:<EOL><INDENT>recompile = True<EOL><DEDENT>if recompile:<EOL><INDENT>print('<STR_LIT>' % (lf, outf))<EOL>p = parser.LessParser(<EOL>yacc_debug=(args.debug),<EOL>lex_optimize=True,<EOL>yacc_optimize=(not args.debug),<EOL>scope=scope,<EOL>tabfile=yacctab,<EOL>verbose=args.verbose)<EOL>p.parse(filename=lf, debuglevel=<NUM_LIT:0>)<EOL>css = f.format(p)<EOL>if not args.dry_run:<EOL><INDENT>with open(outf, '<STR_LIT:w>') as outfile:<EOL><INDENT>outfile.write(css)<EOL><DEDENT><DEDENT><DEDENT>elif args.verbose:<EOL><INDENT>print('<STR_LIT>' % lf, file=sys.stderr)<EOL><DEDENT>sys.stdout.flush()<EOL><DEDENT>if args.recurse:<EOL><INDENT>[<EOL>ldirectory(<EOL>os.path.join(inpath, name), os.path.join(outpath, name), args,<EOL>scope) for name in os.listdir(inpath)<EOL>if os.path.isdir(os.path.join(inpath, name))<EOL>and not name.startswith('<STR_LIT:.>') and not name == outpath<EOL>]<EOL><DEDENT>
Compile all *.less files in directory
    Args:
        inpath (str): Path to compile
        outpath (str): Output directory
        args (object): Argparse Object
        scope (Scope): Scope object or None