Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's exactly what I'm looking for - I need an '' file that can copy a file (example):


to another folder:


and then it would rename the 'file-to-copy.apk' in the 'system' folder to:


and copy it back to:


It would have to overwrite an already existing 'renamed-file.apk' in 'system/framework' folder.

Note: The permissions can NOT change.

Is it even possible to do this?

Any help would be appreciated!

share|improve this question
Why is this too localized? – Richard Borcsik Dec 18 '12 at 7:15
To tell the truth, I just need the correct commands and syntax for update-script or updater-script. – Drejon Dec 18 '12 at 10:30

Actually you can do that by using the run_program syntax in updater-script to execute a shell script that moves/copies/pastes files while in recovery. But of course, you must extract the files that are to be pasted in somewhere (/tmp for instance).

Part of the updater-script:

package_extract_dir("stuff", "/tmp/stuff");
set_perm(0, 0, 0755, "/tmp/stuff/");

The sample shell script can be like this (named in this case):

# Backup files
cp /system/framwork/something.apk /path/you/want

# Paste files
cp /tmp/somethingssss.apk /system/framework/something.apk

# Set back permissions (the copied file has the same permissons, but the new ones does not)
chmod 644 /system/framework/something.apk

But remember, the EOL of updater-script and the shell script must be the same, in UNIX format, or else it won't work.

share|improve this answer

Copy a file (-p preserves permissions and ownership):

run_program("/sbin/cp", "-p", "/system/framework/file-to-copy.apk", "/system/file-to-copy.apk");

Rename a file (will overwrite the destination file):

rename("/system/file-to-copy.apk", "/system/renamed-file.apk");

For reference, the syntax for Edify scripts (that's what they're called) is here: Edify syntax

share|improve this answer

You cannot execute zip files.

You can move/delete/rename a file in /system/ via adb but you must remount /system/ as writable.

share|improve this answer
Actually, you can 'execute' .zip files via the recovery mode. I cannot use ADB because my device is half-bricked and the USB debugging isn't enabled. – Drejon Dec 17 '12 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.