3 ms·
Trying to figure a workaround in ksh for space-delimited filenames: for f in $(ls "/mnt/dir"); do cp -v "$f" /elsewhere done Because -R doesn't handle
by turtleyacht 2y ago
Trying to figure a workaround in ksh for space-delimited filenames:
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.
- turtleyacht 2y agoPipe and read per line: ls /mnt/dir | while read line; do cp -v "$line" /elsewhere # substitute with something fancy # [ $? -eq 0 ] || cp -v "$line" /elsewhere done
- nailer 2y agoIf there’s transmission errors, I would recommend using rsync rather than cp. that will keep transferring and running checksums until everything matches.
- turtleyacht 1y agoThank-you. After installing openrsync(1) (and rsync), files transferred for a bit but failed and dumped core with error 138 (bus error). Maybe a quirk with OpenBSD 7.6, or interaction between simple-mtpfs and the fusefs mount. 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.