File::DirObject
Traverse directories with methods. This is a very simple module where you can traverse directories and see their contents. None of the methods are destructive or actually manipulate anything it's simply designed for reading directory trees, and using that data somewhere else.
use File::DirObject::Dir; # use File::DirObject::File; my $dir = File::DirObject::Dir->new('/home/ubuntu/'); foreach ($dir->dirs) { # do stuff with child dir objects } foreach ($dir->files) { # do stuff with child file objects } # get parent dir my $parent = $dir->parent_dir;
MIT
To install File::DirObject, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::DirObject
CPAN shell
perl -MCPAN -e shell install File::DirObject
For more information on module installation, please visit the detailed CPAN module installation guide.