getting previous filename

hello experts,

H r u . i just need to get the previous file from the latest file let say.

fileA
fileB
fileC
fileD
fileE
in this case fileE is the latest file but i need a script which will always get the name of the previouse file like fileD.
currently i am using this command to get the file.
filename=`ls -1rt|tail -2|head -1`
echo $filename
fileD
But i dont want to use this methaod is there is any other way to achive this task.
Please help me out

Regards,
shary

Another way:

filename=`ls -1t| awk 'NR==2{print;exit}'`

Regards

hi could you please tell me one more way to do this thanks in advance

What exactly you want to achieve ?
Any specific reasons?