in reply to Re: Use Of Glob On File Extensions (find/rule)
in thread Use Of Glob On File Extensions
First, I would like to thank you for your help. Second, this is the first time I have heard of File::Find, so I had to study it. Is it possible to recursively go through directories with something like this?
#!/usr/local/bin/perl use strict; use warnings; use File::Find; my @argv; my $dir = $ARGV[0]; find(\&recursiveDir, $dir); sub recursiveDir{ return if -d; my @files = glob "${dir}/*pl"; foreach (@files) { next if -d; (my $txt = $_) =~ s/pl$/txt/; rename($_, $txt); } }
|
|---|