From 36cc876558be1f119c2cc4f68e5bb8b06185a4e1 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sun, 4 Nov 2012 11:44:23 -0800 Subject: [PATCH] Add crappy script to get sorted filesize of files in directory This script is not very good, it's buggy and slow. I really need to fix it or make it something better one of these days --- bin/filesize | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/filesize diff --git a/bin/filesize b/bin/filesize new file mode 100755 index 0000000..06352c8 --- /dev/null +++ b/bin/filesize @@ -0,0 +1,16 @@ +#!/usr/bin/env perl + +# Get sorted list files +my @sortedFiles = `du -s * | sort -nr`; + +foreach my $file (@sortedFiles) { + # Get just the file name, remove size + my @fileName = split("\t", $file); + my $realFileName = @fileName[1]; + chomp($realFileName); + + # Print the size of the file and the file size + my $fileSortedPrintCmd = "du -hs \"$realFileName\""; + print `$fileSortedPrintCmd`; +} +