tags:

views:

31

answers:

1

Maybe I'm missing something, but when I type do a verbose ditto command (ditto [-v] [-V] 2>>some.log), it will send regular output to stderr. Therefore, my some.log file will be filled with entries like copying file ....

This doesn't make logical sense to me, but it's what the manual says as well:

-V            Print a line of output to stderr for every file, symbolic
              link, and device copied.

I haven't verified this, but I assume that actual I/O errors are sent to stdout. My original want was to display regular output, but log all errors. So assuming that errors are sent to stdout, then this problem isn't really much of a problem - it's just that the semantics don't make sense to me.

So, this should give me the correct outputs:

ditto -V /some/path/ /some/other/path 1>>some.log
A: 

Actually, ditto sends both error messages and verbose status messages to stderr. The reason is that if it's in -c (create archive) mode, and the destination file was specified as -, it writes the archive to stdout. Having status messages mixed in with the archive would be very very bad. BTW, tar -v does the same thing, for the same reason.

Gordon Davisson
I tried this before though: `ditto -V /some/path/ /some/other/path 2>>some.log` and in my terminal I got output saying:I/O Error [...], but in my log, I got all the copying, etc. So what's the best way to get the log of errors - is it possible at all?
sudo work
When I tried using `ditto` to copy a file I don't have read access to, it printed the error to stderr. Are you sure that I/O Error message was coming from `ditto`?
Gordon Davisson
Perhaps not? I just tried after removing read access, and it was went to stderr; however, I was attempting this on a system with a bad harddrive earlier, and the I/O error printed to stdout (perhaps not by ditto).
sudo work