Reputation: 560
I have a directory with around 50,000 .jpg images. Let's call this directory "imageDir", and the empty directory I'm trying to copy to "outputDir".
when I execute:
cp imageDir/* outputDir/
around 30,000ish images through I get:
cp: cannot open `imageDir/234235.jpg' for reading: Bad address
(this does not always occur on the same file) and then the copy operation will cease without copying the rest of the files.
I tried adding the -R
option after reading that it would continue the copy even if errors occurred:
cp -R imageDir/* outputDir/
but this did nothing to solve my problem.
Is there some sort of limit to the number of files you can successfully copy at a time? Why am I seeing this error, and how can I solve it? (if it happened for just photos here and there, I'd be fine with it as long as it completed the rest!)
Additionally: this is using Cygwin on Windows 7. Thanks!
Upvotes: 1
Views: 2998
Reputation: 18279
Looks like an issue with Cygwin to me. Since you said it happens randomly, you might just want to try again when it happens. Here's a script (untested) that will do that:
#!/bin/sh
for i in imageDir/*
do
cp $i outputDir/
while [ $? -ne 0 ]
do
cp $i outputDir/
done
done
Upvotes: 3