42 users online | 42 Guests and 0 Registered

How to rename a file with date stamped


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
2017-10-12 22:24 Eric P {writeRevision}
Average rating: 0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category


Sticky FAQs