#!/usr/bin/perl -w @file=`find * -type d`; foreach (@file) { `cd $_;/somepath/foo`; }