Appending sequence number at the end of file name

hi team,

i need a script for renaming a file with sequence number. script get a file from one directory'

/home/billing/Cmm/sms/sms_tmp

' append sequence no at the end of file name and move a file to other directory

/home/billing/Cmm/sms/

.
actual file is

cdr201508271527

file after renaming

cdr201508271527_00001

. script also have capability to save the state of sequence number so when next time it will increment it will start increment from the last file transferred. i have a multiple files in /home/billing/Cmm/sms/sms_tmp . each file can be identify with time stamp.

What have you tried so far?

1 Like

On top of answering jim mcnamara's question, you should consider supplying more details, e.g. is it one file, multiple or all files in the source directory, and how to discriminate between them, and based on which criteria the sequence numbers should be distributed.

1 Like

After telling us what you tried so far yu might also want to tell us what your problem is. So far you haven't asked anything specific. You do know there is a mv command to move and rename files, yes?

I hope this helps.

bakunin

1 Like