trim dir name if overflowing