I have a root Linux shell open on my Android device, and while using cp to copy a directory, I get an error. I think I know where the error is coming from, so that is not my question.

I want to find a command that will allow me to copy everything within this directory that it can, and not just quit upon encountering an error. This is an example of what happens right now:

root@flo:/ # cp -r -v /d/* /sdcard/test/
cp '/d/TRRS'
cp: xread: Invalid argument
1|root@flo:/ #

How should I go about this?

  • 1
    What does ls -l /d/TRRS say? – Kusalananda Jan 7 '17 at 21:19
  • 1
    You may think that error is secondary but cp -r is actually meant to do what you're asking. It does accept a force option (-f) but I don't think it would overcome a fatal error like you're getting. – Julie Pelletier Jan 7 '17 at 21:21
  • @Kusalananda ls -l /d/TRRS gives: -r--r--r-- root root 0 1969-12-31 19:00 TRRS – josh798 Jan 7 '17 at 21:28
  • What do you get from ls -la /d/.? – Julie Pelletier Jan 7 '17 at 21:37
  • @JuliePelletier Here's what I get from ls -la /d/.. And just to reiterate, I'm pretty sure I know why it is failing, but I just need a command that can recover from this type of error. – josh798 Jan 7 '17 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.