changed -f -> -d for directory