Works with multiple files but only works one by one