Perhaps this should be handled by the parent class, or by separate, which prevents having to rewrite this code for new File subclasses.