Using Bash, how can you traverse folders within specified folder, find all files of specified file type, and every time you find a file, get full file path with file name and full file path without file name as a variables and pass them to another Bash script, execute it, and continue searching for the next file?
looks very much like homework.
find /path -type f -name "*.ext" -printf "%p:%h\n" | while IFS=: read a b
do
# execute your bash script here
done
read the man page of find for more printf options....
Assuming a GNU find (which is not unreasonable) you can do this using just find:
find /path -type f -name '*.ext' -exec my_cool_script \{\} \;
find is the way. Using xargs handle long list of files/dirs. Moreover to handle correctly names with spaces and problem like that, the best find line command I've found is :
find ${directory} -name "${pattern}" -print0 | xargs -0 ${my_command}
The trick is the find -print0 that is compatible with the xargs -0 : It replace endlines by '\0' to correctly handle spaces and escape characters. Using xargs spares you some "line too long" message when your filelist is too long.
You can use xargs with --no-run-if-empty to handle empty lists and --replace to manage complex commands.
If you have GNU Parallel http://www.gnu.org/software/parallel/ installed you can do this:
find . -name '*.ext' | parallel echo {} '`dirname {}`'
Substitute echo
with your favorite bash command and ext with the file extension you are looking for.
Watch the intro video for GNU Parallel to learn more: http://www.youtube.com/watch?v=OpaiGYxkSuQ