one callback for file and dir