Just a little warning: The "for i in..." paradigm breaks if the strings you're iterating over have spaces in them. The way around that is to either use find and/or xargs instead of "for i in", or to first set the IFS variable to a value that doesn't contain spaces.