LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (http://www.linuxquestions.org/questions/general-10/)
-   -   How could I use cp and avoid stdout output (error messages)? (http://www.linuxquestions.org/questions/general-10/how-could-i-use-cp-and-avoid-stdout-output-error-messages-4175443447/)

stf92 12-30-2012 03:45 AM

How could I use cp and avoid stdout output (error messages)?
 
Hi:

When copying files (cp) to an NTFS partition, as is logical, I get something like 'Unable to preserve permissions'. OK. But writing to stdout is a slow process. How could I use cp and avoid stdout output? Perhaps redirecting stdout to stderr? Or to /dev/null? How do I do it?

btmiller 12-30-2012 03:50 AM

cp source destintation >/dev/null 2>/dev/null

would send both stdout and stderr to /dev/null -- could also be done with 2>&1 and then redirecting everything to /dev/null. Actually, since by default cp does not print to stdout, simply redirecting stderr to /dev/null would be sufficient.

TobiSGD 12-30-2012 06:48 AM

You also can tell cp not to preserve file attributes with the option --no-preserve=all

stf92 12-30-2012 02:05 PM

Thanks guys. Very helpful information.


All times are GMT -5. The time now is 03:22 AM.