Re: testing files for read errors by copying to /dev/null
James Michael Fultz wrote:
> * Charles Russell <NOSPAM@bellsouth.net>:
>> I would like to test the integrity of a CD (after burning from .iso) by
>> reading all its files and looking for error messages. (I'm using Cygwin,
>> so I cannot access the CD drive as a dev/, only as a mounted filesystem.)
>>
>> If I try
>> cp -rv /cygdrive/d/* /dev/null
>> then I get a message that /dev/null is not a file or directory
>>
>> If I try
>> tar -cvf /dev/null /cygdrive/d
>> then the command runs so fast it cannot possibly be reading the whole CD.
>>
>> If I try
>> find /cygdrive/d -type f -name '*' -print -exec cat {} >/dev/null \;
>> then the disk drive seems active for a reasonable length of time, but
>> despite the -print flag, I get no output to confirm what is actually
>> happening. I expected the filename to be printed before each file was
>> read.
>
> The shell is responsible for redirection so...
>
> $ find /cygdrive/d -type f -print -exec sh -c 'cat "$1" >/dev/null' {} {} \;
Yes, that works
>> What is the best way to do what I am attempting?
>
> Not sure whether it is the *best* way, but the following should work:
>
> $ find /cygdrive/d -type f -exec cp -v {} /dev/null \;
>
That yields the error message:
cp: cannot create regular file `/dev/null': Invalid request code
I don't know whether this is typical unix behavior or something peculiar
to Cygwin, which is usually a pretty close emulation. As noted in my
original posting, cp does not like /dev/null.
|