def files_in_directory(db, user_id, db_dirname):
fields = _file_default_fields()<EOL>rows = db.execute(<EOL>select(<EOL>fields,<EOL>).where(<EOL>_is_in_directory(files, user_id, db_dirname),<EOL>).order_by(<EOL>files.c.user_id,<EOL>files.c.parent_name,<EOL>files.c.name,<EOL>files.c.created_at,<EOL>).distinct(<EOL>files.c.user_id, files.c.parent_name, files.c.name,<EOL>)<EOL>)<EOL>return [to_dict_no_content(fields, row) for row in rows]<EOL>
Return files in a directory.