I'm failing at writing a script for Smanager to copy files from one folder to another. Then change the extension. In the example below i'm trying to copy files from folder2 to folder1 and adding the mp3 extension to all files (filename.test) so it becomes filename.test.mp3. But its not working. Anyone have ideas how to fix it (on a S3)? I tried a "syncing widget" but it deleted existing files instead of just copying over the new ones.

#!/bin/sh

su
mount -o remount, rw /system
OUT="/storage/extSdCard/folder1"
INV="/storage/sdcard/Android/data/folder2"

MP3=folder2

cd $INV/$MP3
for file in *
do name=${file%.*}
busybox cp $file $OUT/$MP3/$name
ext=.mp3
for f in *.temp
do
mv $f $f$ext
done

mount -o remount, ro /system
exit