How to rename a file with date stamped

2017-10-12 22:24


Assuming that you have a directory /logs

This is the actual command that runs on one of my  cron jobs.



logwatch --detail=High --range=Today >/logs/watchdog.txt  && mv /logs/watchdog.txt /logs/"´date +%Y-%m-%d_%H´.txt" 


To rename a file

mv /logs/watchdog.txt /logs/"´date +%Y-%m-%d_%H´.txt" 



dt=$( date +%Y%M%d ) && cp /var/Vol1/backup/pdf_form /var/Vol1/backup/"$dt"_pdf_form ;

Tags: date, rename file with date
Average rating 0 (0 Votes)

You cannot comment on this entry