This is an old revision of the document!
Shell
Do something recursively on all files
Use bash, with {}
being the file name:
find . -type f -exec <command> {} \; find -iname "<pattern>" -exec <command> {} \;
Manual solution:
#!/bin/sh function search_dir() { DIR=$1; for file in $DIR/*; do if [[ -f $file ]]; then echo "Do something with $file" fi; done for element in $DIR/* ; do if [[ -e $element && -d $element && \ $(basename "$element") != ".." && \ $(basename "$element") != "." ]]; then search_dir "$element"; fi; done; } search_dir "."