this code will be really slow in that case unless it's being used on a local filesystem...