Basic directory sorting functionality