I want add the date next to a filename (“somefile.txt”). For example: somefile_DDMMYYYYHHMMSS.txt
Maybe a script will do or some command in the terminal window. I’m using Linux.
Thanks in advance.
Advertisement
Answer
Something like can do the work:
a=somefile.txt bname="${a%.*}" ename="${a##*.}" date=$(date +%d%m%Y%H%M%S) echo ${bname}_${date}.${ename}