adb shell command: mkdir (for creating a directory)

38,477

Solution 1

http://android-tricks.blogspot.in/2009/01/mount-filesystem-read-write.html

mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

This was useful: now i can create directory :)

Solution 2

[Trick] Make a dir (or various) in a non-rooted phone using adb push:

if you use the command

adb push myfolder /storage/sdcard0/Download

and "myfolder" contains another folders inside, these folders will be created inside the "Download" folder of the phone

So, the hack i use to install assets inside my apps:

adb push assetfolder /storage/sdcard0/Android/data/com.myapp.name/

then "assetfolder" contains

assetfolder/
   assetfolder/db/mysqlite.db
   assetfolder/img/myimage.png
   assetfolder/json/initial-data.json

etc

Then my app has its

com.myapp.name/db/mysqlite.db
com.myapp.name/img/myimage.png
com.myapp.name/json/initial-data.json

Hope it helps!

Share:
38,477
Chanakya.sun
Author by

Chanakya.sun

Updated on July 09, 2022

Comments

  • Chanakya.sun
    Chanakya.sun almost 2 years

    I am trying to create a directory through adb shell

    I have to create a directory in etc folder which was unsuccessful. I managed to figure out that it is linked to /system/etc and tried to create in /system/etc, but in both cases I was getting "Read only File System".

    How to make it Read write?

    I tried switching to super user using "su".

    I tried modifying udev/rules.d in the host machine:

    created a file 51-android.rules with " SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"  "
    

    I'm still getting the same "Read only File system".

    How do I fix this?

  • Chris Stratton
    Chris Stratton over 10 years
    It's not only unwise to make a system file writable by all users, it's also not a solution to a "read only file system" - the issue is with the mounting of the file system, not the permissions of the individual file.
  • Donald Duck
    Donald Duck over 2 years
    This works fine if the folder contains files, but if I try to do this with an empty folder it outputs "0 files pushed, 0 skipped" and doesn't do anything.
  • voghDev
    voghDev over 2 years
    Right @DonaldDuck. I confirm the folder I was copying had files inside. I guess the workaround for your case is adding a small file to the folder, so the copy has successful result