A version that can work for directory.