Re: Listing files and their sizes

2007-09-18 Thread useperl-jeff
--- Telemachus Odysseos <[EMAIL PROTECTED]> wrote: > > #!/usr/bin/perl > > opendir(CD,"/path/to/directory/here"); > while ( $_ = readdir(CD)) { > next if $_ eq "." or $_ eq ".."; > print $_, " " x (30-length($_)); > print (-s $_ ); Here you need to specify the absolute

Re: Listing files and their sizes

2007-09-18 Thread John W. Krahn
Telemachus Odysseos wrote: Hi, Hello, 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

Re: Listing files and their sizes

2007-09-18 Thread davidfilmer
On Sep 18, 1:59 pm, [EMAIL PROTECTED] (Telemachus Odysseos) wrote: > 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. That's because readdir returns a plain filename. You need to eithe

Re: Listing files and their sizes

2007-09-18 Thread Dr.Ruud
"Telemachus Odysseos" schreef: > [...] it prints the filenames > but not the sizes. [...] perldoc -f readdir: "you'd better prepend the directory in question". > #!/usr/bin/perl Missing: use strict; use warnings; > opendir(CD,"/path/to/directory/here"); my $dir_name = "/path/to/dire

Listing files and their sizes

2007-09-18 Thread Telemachus Odysseos
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

Re: listing files

2002-01-29 Thread Sudarsan Raghavan
Michael Pratt wrote: > This is what I want to do and I dont know where to start: > > List files in a directory taking that list with just the filename and no > other information Use the glob operator of perl (perldoc -f glob) while (<*>) { print "$_\n"; } This should

Re: listing files

2002-01-29 Thread Jon Molin
Michael Pratt wrote: > > This is what I want to do and I dont know where to start: > > List files in a directory taking that list with just the filename and no > other information. using that information and populating a listbox. Check out 'perldoc -f opendir perl'. Perhaps the File:: modules s

listing files

2002-01-28 Thread Michael Pratt
This is what I want to do and I dont know where to start: List files in a directory taking that list with just the filename and no other information. using that information and populating a listbox. Can someone help? Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands