Hi,
I have read around and cannot seem to find an answer to this, and it's
driving me a bit nuts. I have a small script that I am trying to use to list
the items in a directory and the size of the items. The script works
perfectly if I run it in the directory itself, but if the script is
somewhere else in my system, it prints the filenames but not the sizes. I
have tried changing ownership of the perl script every which way (thinking
it's a permissions problem), but even if the script is owned by root, no
joy. Here is the script. Any ideas would be greatly appreciated:
#!/usr/bin/perl
opendir(CD,"/path/to/directory/here");
while ( $_ = readdir(CD)) {
next if $_ eq "." or $_ eq "..";
print $_, " " x (30-length($_));
print (-s $_ );
print "\n";
}