Write a program that copies all files with a .ico filename extension in a directory hierarchy to a directory named icons in your home directory. (Hint: Use the File::Find and File::Copy modules.)
What will be an ideal response?
$ cat icon-copy.pl
use File::Find;
use File::Copy 'copy';
find( \&handle_file, '.' );
sub handle_file {
if ( -f $File::Find::Name && $File::Find::name =~ /\.ico$/ ) {
copy( $File::Find::name, '~/icons' );
}
}
Computer Science & Information Technology