I haven't tested this, but my guess is that you are running three separate commands, with system()
.
So, you run one command to change directory, and then nothing else.
The second command to rm -R images
is then run by itself, and not performed with /var/mobile/Library/Caches
as the current directory.
You might try simply combining all three commands into one:
system("cd /var/mobile/Library/Caches/com.apple.keyboards; rm -R images; rm version");
If that doesn't work, report back and maybe there's another problem.