How can I rename all the files with a pattern like this:
thumb_f318d8a580ca5717d686a323b6c2ca0d.jpg0000777 thumb_f18d8aup90ca5717d686a323b6c2c5uh.jpg0000777 thumb_jessr8d8a580ca5717d68623etrtckks.jpg0000777 thumb_4hghd8a580ca5717d686a323b6c2ghjj.jpg0000777 ....
to
thumb_f318d8a580ca5717d686a323b6c2ca0d.jpg thumb_f18d8aup90ca5717d686a323b6c2c5uh.jpg thumb_jer8d8a580ca5717d686a323etrtckks.jpg thumb_4hghd8a580ca5717d686a323b6c2ghjj.jpg ....
Answer
Use bash variables and a for loop:
for i in *;do mv $i ${i%0000777};done
when you surround the variable name with {} and add a % sign, it returns the value of the variable with everything after the % removed.
If you use a # sign it will remove from the beginning of the string. so
for i in *;do mv $i ${i#thumb_};done
Would strip the thumb_ off the front.
Attribution
Source : Link , Question Author : ninjascorner , Answer Author : Mixologic