summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/eg/dus
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/eg/dus')
-rw-r--r--gnu/usr.bin/perl/eg/dus22
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/eg/dus b/gnu/usr.bin/perl/eg/dus
new file mode 100644
index 00000000000..78062f82a4d
--- /dev/null
+++ b/gnu/usr.bin/perl/eg/dus
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+# $RCSfile: dus,v $$Revision: 1.1 $$Date: 1996/08/19 10:11:53 $
+
+# This script does a du -s on any directories in the current directory that
+# are not mount points for another filesystem.
+
+($mydev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+ $blksize,$blocks) = stat('.');
+
+open(ls,'ls -F1|');
+
+while (<ls>) {
+ chop;
+ next unless s|/$||;
+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+ $blksize,$blocks) = stat($_);
+ next unless $dev == $mydev;
+ push(@ary,$_);
+}
+
+exec 'du', '-s', @ary;