Skip to content
Advertisement

Problem with special filenames when trying to pull android files into windows pc recursively using adb

I want to download all files from /data/data/foo folder to my pc. I am using adb to connect with my phone.

cd /data/data/foo
ls -R
.:
    cache
    databases
    files
    lib
    shared_prefs

./cache:

./databases:
    errors.db
    errors.db-journal
    logs.db
    logs.db-journal

./files:
cache_state.info

./shared_prefs:
LANG_CODE.xml
PPP.xml
CADD
.xml

To download files I am using:

adb pull "/data/data/foo" %USERPROFILE%/foo

And here’s response:

pull: building file list...
skipping special file 'lib'
pull: /data/data/foo/files/cache_state.info -> C:Usersroot/foo/files/cache_state.info
pull: /data/data/foo/shared_prefs/CADD
.xml -> C:Usersroot/foo/shared_prefs/CADD
.xml
cannot create 'C:Usersrootfooshared_prefsCADD
.xml': No such file or directory

And in fact, only this is copied:

foo/files/cache_state.info
foo/shared_prefs

What I am doing wrong here?

Advertisement

Answer

The problem:

What you’re doing is right (the command is correct), but the problem comes from the nature of the task you’re trying to achieve.

You’re trying to copy files from a unix device (an ext filesystem) into your windows pc (with NTFS filesystem). This usually works fine but there are cases when it doesn’t: different filesystems have different rules as to which filenames are valid, and if a filename is valid in the source but not in the destination, there’s no way to copy it preserving it’s name.

From the error I understand you have a file named CADD .xml (with line break included in the name) that is valid in your android device but will give an error when trying to copy it into your windows filesystem (see Which file systems support newlines in file names?).

Possible solutions:

  • Copy the files one by one and set a different destination name for the file causing trouble (CADDn.xml -> CADD.xml)
  • Get some ext filesystem (either create it in your disk or mount from an external disk) and copy the files there
  • Copy the file into the ext filesystem used by your in-windows bash shell (see How to Access Your Ubuntu Bash Files in Windows )
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement