Executing a command with too many arguments at Crontab

Hi:

In my crontab, when executing the comand below, due to a great number of msg files in lixo directory, it returns a too many arguments error message:

/bin/cp /var/spool/mail/lixo/msg.* /var/spool/mail/lixo/vespera/

I was told there's a way using find / print0 / xargs, but I don't know how to code it. Can anyone help me?

Thanks.

Mario./
multisitesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jlevieConnect With a Mentor Commented:
/usr/bin/find /var/spool/mail/lixo -name "msg.*" | xargs -i{} /bin/cp {} /var/spool/mail/lixo/vespera
0
All Courses

From novice to tech pro — start learning today.