toulon
asked on
to name a file after the date
in a cron script I want to name an output file after the date of the day in command line like :
ls > 'fileoftheday'.log
Could you tell me how I do that?
Thx.
ls > 'fileoftheday'.log
Could you tell me how I do that?
Thx.
ls > `date '+%d%m%Y'`.log
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
($day,$month,$year) = (localtime)[3..5];
$date_string = sprintf("%04d%02d%02d%s", $year+1900, $month+1, $day,'.log');
system("ls > $date_string");