Possible Duplicate:
Recursive rename files and directories
I wrote the following script:
#!/bin/bash
SAVEIFS=$IFS
alias export='export'
IFS=$(echo -en "\n\b")
find $1 -name "*" -a -type f -exec sh -c let len=`expr length {}` \; -exec sh -c let str=`expr substr {} 1 len-3` \; -exec ffmpeg -y -i {} $str.mp3 \;
# restore $IFS
unalias export
IFS=$SAVEIFS
Problem:
You know when more one shell you can't export your variable in other shell, So i need to :
use variables
don't use run shell
So, how i do it?
When run the following script:
find $1 -name "*" -a -type f -exec let len=`expr length {}` \; -exec let str=`expr substr {} 1 len-3` \; -exec ffmpeg -y -i {} $str.mp3 \;
# Note : above script doesn't has 'sh -c'
I get the following error:
find: `let': No such file or directory
I tested it with export or delete export or let , i discovered -exec has problem with built-in shell command....!
Do you have any idea????