Linux rename files based on another file in the directory?
I've got about 750 directories that contain two files each: long_somewhat_random_filename.jpg thumb.jpg What I'd like to do is use find or something similar to rename thumb.jpg to long_somewhat_random_filename_thumb.jpg . My brain's kinda fuzzy at the moment. I could do it with a perl script, but if there's a somewhat easy way to do it in bash, that's easier. Give the script below a shot. Right now the echo makes it benign so you can try before you buy so to speak. If you like what you see, remove the echo and run the script again to actually make the changes. #!/bin/bash while read file; do