I'm trying to set a cron job for a script which will append current date/time and number of files in a certain directory a file. I'm able to do this for only number of files:

ls | wc -l >> /root/log.txt

But how can I include the date/time in this entry?

link|improve this question

55% accept rate
feedback

1 Answer

up vote 1 down vote accepted
$ echo "$(date) $(ls -1 | wc -l)" >> /root/log.txt
link|improve this answer
Thanks for your speedy reply! – Cem Oct 9 '11 at 12:14
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.