file delete updated to work with directories