I'm trying every single code to copy all things inside a folder to another but i can't do it! I'm trying to use the code in my terminal emulator in my android device because i need that code in my application. This is the last code i use that doesn't work:
#!/bash/sh
srcdir="/data/app"
dstdir="/sdcard/prova1"
for f in ${srcdir}/*.apk
do
cp $f $dstdir $dstfile
done
and the terminal says:
: not found
' unespectedsyntax error: 'do
can anyone help me? These are the possibility that could be good:
1) Copy all files in the /data/app folder to /sdcard/prova1
2) Copy directly the folder app in prova1
3) Use a java code that do one of these two things..
I have root so i can do this operation.
None of these answers worked for me for recursive copy. Found this in a script in one of my libraries and thought I'd share it (with a subfolder example for both the source and destination, which is what I needed):
SOURCE="/my/folder"
DESTINATION="/my/destination"
cp -r "$SOURCE/subdir/"* "$DESTINATION/another_sub/"
With this, every subfolder and every file was copied.
I don't know why but the asterisk outside the quotes in the source did the magic for me (using bash 4.3.11 here)
how about this, where src and dest are directories: cp -r src dest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With