File check script

Hi,

This script may be basic for expert,

How to monitor files on a special folder (ls -rtla) and output the result to a file with timestamp name ?
I'll schedule the script with Cron.

Thanks,

Fabien

#!/usr/bin/sh
cd <hardlink to the folder directory>
{
echo `date`
`ls -rlta <directory>/<filename> or *`
} >> output.log
#!/bin/sh
/bin/ls -rtla /path/to/somedir > /path/to/output.$(date +%y%m%d-%H%M%S)

You can use

#!/bin/sh
/bin/ls -rtla /path/to/somedir > /path/to/output.$(date +%y%m%d)

if you only need the date.

why Do I get this error ?

ls -rtal /tmp > /tmp/test.$(date +%y%m%d-%H%M%S)

syntax error: `(' unexpected

You must be using an ancient shell. Try this (backquotes: ``) instead:

ls -rtal /tmp > /tmp/test.`date +%y%m%d-%H%M%S`

Great,

thanks,

Fab