Executing a command with too many arguments at Crontab

Posted on 2004-10-24
Last Modified: 2013-12-16

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?


Question by:multisites
    1 Comment
    LVL 40

    Accepted Solution

    /usr/bin/find /var/spool/mail/lixo -name "msg.*" | xargs -i{} /bin/cp {} /var/spool/mail/lixo/vespera

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now