I am trying to rename a file with the
mv command and I would like to add the last modified date of this file (with YYYYMMDD format) on the file name and move it to other folder. I got the current system date like this:
mv /home/user/Desktop/a.txt "/home/user/Desktop/testfolder/$(date +%Y%m%d)-a.txt"
I used other combinations of
date but I didn't get it. I need to know if it is possible do it directly by command line or I need to create a script.