#!/usr/local/bin/perl # # recurs.pl # # This script executes recursively on subdirs the command you supply as a parameter # # Run "program -h" to see the run options # # Last modified: Apr 10 1997 # Author: Bekman Stas # $|=1; # Set here the pattern extensions of your image files # Usage (@ARGV == 1 ) || die ("Usage: recurs.pl [-h] \n\t-h this help\n\n"); $command=$ARGV[0]; #$command=~s/(.*)/'$1'/; &recursive(); # Subroutine "recursive" goes recursively down at the dir tree and # and runs the $ARGV[0] for you. After comming to the end it's coming back up # at the tree. sub recursive { system($command); #print "$command\n"; #die; foreach $dir (<*>) { if (-d $dir) { # print "$dir\n"; chdir $dir; &recursive(); chdir ".."; } } }