Add loop function to loop through subdirectories and run given command.