for f in $(ls "/mnt/dir"); do
cp -v "$f" /elsewhere
done
Because -R doesn't handle retries when cp(1) errors out intermittently (USB MTP to phone). I don't remember it being this hard in bash, or Android just is like this. Hopefully can figure it out without going to perl or C. Maybe dump(8).Even though 54 GB partition created, it only takes up 22 GB or so. Either missing a lot of files or FFS compacts it well.
ls /mnt/dir | while read line; do
cp -v "$line" /elsewhere
# substitute with something fancy
# [ $? -eq 0 ] || cp -v "$line" /elsewhere
done
In the meantime, after a few retries, the failures are written to a log for a second sweep.
MD5 check helps skip extra copying, but it's overall much slower. It seems okay for a long-running batch job; maybe something we can return to after getting the pictures to display.
The pattern is like
cp ... || \
{ sleep 2; cp ... ; } || \
... || \
... || echo "$file" >> retry.log
Not the best way. It has failed before all four times. Going to let it run overnight to see if it completes.
sherdil2022•2w ago
gooob•2w ago
sherdil2022•2w ago