Rename dirs to ds

This commit is contained in:
Fred Boniface 2023-10-02 22:42:59 +01:00
parent 66e45b675c
commit df8438cc52

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# dirs - calculate and display the size of a given directory in a human readable format
# ds - calculate and display the size of a given directory in a human readable format
# Copyright Frederick Boniface 2023 - fredboniface.co.uk
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -25,8 +25,13 @@ use strict;
use warnings;
use File::Find;
if (@ARGV != 1) {
die "Usage: $0 <directory_path>\n"
if (@ARGV == 0) {
print <<EOF;
\nUsage: $0 <directory_path>
Calculate the size of a directory and its contents.\n
EOF
exit;
}
my $dir_path = $ARGV[0];
@ -36,7 +41,7 @@ unless (-d $dir_path) {
}
if ($dir_path eq '/') {
die "You are not able to run 'dirs' on the root directory\n"
die "You are not able to run 'ds' on the root directory\n"
}
my $total_size = 0;