micalexander
8/8/2013 - 9:12 PM

bash:search with in current directory and locate files that are not prefixed with an underscore and have an extension of .scss and, prefix w

bash:search with in current directory and locate files that are not prefixed with an underscore and have an extension of .scss and, prefix with an underscore.

#!/bin/sh

proj_dir_arrays=( $(find . -name 'partials' -type d ) )
location=`pwd`
for proj_dir_array in "${proj_dir_arrays[@]}";
do
	cd $location/${proj_dir_array/.\/}

	shopt -s nullglob

	for x in *.scss;
	do
		if [[ $x != _* ]];
		then
			mv $x _${x%};
		fi;
	done
done