Fixed -z test to support paths with spaces