Moving and renaming large ammount of files

Hey, I'm kinda new to the shell scripting and I don't wanna mess things up yet :slight_smile:
Looking for a solution to the following:
I need to move all the files like "filename.failed.dateandtime" to another directory also renaming them "filename.ready". I can't figure how to do this with multiple files and add this to a script. Help will be accepted :slight_smile:

You can always try this in some test/temp directory with some example files so you don't mess up anything. What have you tried so far? Btw, you can always scroll down to the bottom of your thread and see which similar/related threads the forum suggests.

thanks, I rushed before searching. Just of the top of my head will something like this work:
mmv -m *.failed.* /to/here/#1.ready

How about this... Test first!

for i in `find ./ -name *failed*`
do
    newfn=`echo $i |sed 's/failed.dateandtime/ready/'`
    echo "mv $i /somewhere/$newfn"
    # mv $i /somewhere/$newfn
done
$ ls -1 *failed* | nawk -F\. '{print "mv "$0" /somewhere/"$1".ready"}' | sh