in reply to I have a folder which is having 1200 files,all the file names are have maximum of 8 character length.I need to remove last character from each of the filnames and prefix it with character "A"
That could also be a job for a regular expression.
Capture up to 7 symbols, then have an optional single symbol, then capture a literal dot and up to three more characters. Then rename the file to 'A' . $1 . $2
The last step is to realize that things have gone horribly wrong with your requirements as stated, when you notice that you are not guaranteed to have unique filenames after losing the last letter, and files start conflicting with each other.