Try this little script:
#!/bin/sh
FILES=`ls *.sql`
for FILE in ${FILES}
{
BASE=`basename ${FILE} .sql`
mv ${FILE} ${BASE}-AM.sql
}
I just typed that from memory so if it doesn't work 100% don't blame me (i.e., back up your data first ;) )
How it works:
Collect all files into a variable (you could put this inside the for instead but I like to keep things easy to read):
FILES=`ls *.sql`
Loop through each file:
for FILE in ${FILES} { ... }
Get the filename without .sql:
BASE=`basename ${FILE} .sql`
Rename the file, adding -AM.sql to the base name:
mv ${FILE} ${BASE}-AM.sql