Created
October 9, 2012 20:02
-
-
Save zsan/3861078 to your computer and use it in GitHub Desktop.
simple example of the power File::Find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Modern::Perl; | |
use File::Find; | |
#-------------------------------------------------- | |
# no getopt since its very simple | |
#-------------------------------------------------- | |
die "Enter a directory to search\nUsage: perl $0 <dir_path>" unless @ARGV; | |
my $total_size = 0; | |
find(sub { $total_size += -s if -f }, $ARGV[0]); | |
say $total_size; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment