in reply to use File::Find::Rule
I am just going from this comment:
# find all the subdirectories of a given directory.
Before learning about fancy modules, I would recommend learning the basics. The code that you need is not hard.
find()in module File::Find, visits all files below the directory specified, calling the specified subroutine on each file. A directory is also a file! If the file isn't a directory, print_all_directories() just returns, if this is a directory, we figure out the full path name and print it.#!/usr/bin/perl -w use strict; use File::Find; my $start_dir = "C:/"; find (\&print_all_directories, "$start_dir"); sub print_all_directories { return if !-d; my $full_dir_path = $File::Find::name; print "$full_dir_path\n"; }
|
|---|