Rename dirs to ds

This commit is contained in:
Fred Boniface 2023-10-02 22:42:59 +01:00
parent 66e45b675c
commit df8438cc52
1 changed files with 9 additions and 4 deletions

View File

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