fix migration script to read filenames from STDIN