In Android shell (also a linux distro), I want to copy a whole folder to a different folder without specifying the folder name. For example:

cp -R /storage/emulated/0/.Data /storage/emulated/0/backup

After this command, my backup folder should contain the .Data folder and all of it's content. But when I run to run this, only the content of .Data is copied directly to the backup folder (without the .Data parent folder) , that's not what I want.

There is another method, but this is not a generic method so I don't want to apply it:

cp -R /storage/emulated/0/.Data /storage/emulated/0/backup/.Data

Can you please show me how to copy the whole directory without specifying in detail the destination name the folder should have?

closed as off-topic by Gilles, Satō Katsura, countermode, thrig, Anthony Geoghegan Mar 7 '17 at 10:52

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I'm voting to close this question as off-topic because it's about how Android differs from a Unix system (a Linux cp command would not behave this way). Besides this question can't be answered without knowing the version of Android. – Gilles Mar 6 '17 at 1:38
  • Does that version of cp have no equivalent to GNU's -t option? – Toby Speight Mar 6 '17 at 15:33

Browse other questions tagged or ask your own question.