Created
June 27, 2018 15:29
-
-
Save mgregoro/ae9943891feccc799b9b011ba5ee93d7 to your computer and use it in GitHub Desktop.
Perl One-liner: Find size of all subdirectories in a given path; and report time taken to scan sub-directory
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
perl -MString::ShellQuote -E 'opendir(DIR, $ARGV[0]) or die "no: $!\n"; while (my $dir = readdir(DIR)) { next if $dir =~ /^\.+$/; if (-d join(q|/|, join(q| |, @ARGV), $dir)) { say "---------- START $dir ----------"; system("bash -c \"time du -hs @{[shell_quote_best_effort(join(q|/|, join(q| |, @ARGV), $dir))]}\""); say "----------- END $dir -----------\n" }}' $HOME/Library |
Author
mgregoro
commented
Jun 27, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment