wanted {
if (-f $_) {
$total_size_of_files_in_dir += -s;
}
}
sub size_in_mb {
my $size_in_bytes = shift;
return $size_in_bytes / (1024 * 1024);
}
---code---
2009/3/5 Dermot
> 2009/3/5 Lauri Nikkinen :
> > Thanks, although is does not change the differences between dir sizes
&g
lmarsson :
> > Lauri Nikkinen wrote:
> >>
> >> ... from this script I get
> >>
> >> The total size of the file in etc is 15712.35 Kb
> >> The total size of the file in etc is 15.34 Mb
> >>
> >> and when I check this from Win XP Explore
my $size_in_bytes = shift;
return $size_in_bytes / (1024 * 1024);
}
...snip...
same results and I can't figure out what would be the bug here.
-L
2009/3/5 Gunnar Hjalmarsson
> Lauri Nikkinen wrote:
>
>> ... from this script I get
>>
>> The total size of the file in etc
ot;, ($total_size_of_files_in_dir * 0.0009765625)) . "\n";
print "The total size of the file in $dir is " . sprintf("%.2f
Mb", ($total_size_of_files_in_dir * 9.5367431641e-7))
. "\n"
}
sub wanted {
if (-f $_) {
$total_size_of_files_in_dir +
directory;
find(\&wanted, $dir);
print "The total size of the file in $directory is
$total_size_of_files_in_dir bytes\n";
}
sub wanted {
if (-f $_) {
$total_size_of_files_in_dir += -s;
}
}
---code---
-L
2009/3/4 Dermot
> 2009/3/4 Lauri Nikkinen :
> > Tha
also.
-L
2009/3/4 Dermot
> 2009/3/3 Wagner, David --- Senior Programmer Analyst --- CFS
> :
> >> -Original Message-
> >> From: lauri.nikki...@gmail.com
> >> [mailto:lauri.nikki...@gmail.com] On Behalf Of Lauri Nikkinen
> >> Sent: Tuesday, Ma
Ok, thanks. Now I notice that I did not understand correctly what this
script does. I was trying to print sizes of all directories in the directory
tree. But anyway, I appreciate your kind help!
-L
2009/3/3 Chas. Owens
> On Tue, Mar 3, 2009 at 14:59, Lauri Nikkinen
> wrote:
> sn
-
> *From:* lauri.nikki...@gmail.com [mailto:lauri.nikki...@gmail.com] *On
> Behalf Of *Lauri Nikkinen
> *Sent:* Tuesday, March 03, 2009 13:00
> *To:* Chas. Owens
> *Cc:* Wagner, David --- Senior Programmer Analyst --- CFS; Perl Beginners
> *Subject:* Re: Printing directory siz
and ( $size += -s _ ) }, $dir );
~ > perl Print_directory_sizes.pl
~ >
or
~ > perl Print_directory_sizes.pl Documents/
~ >
Do you know why?
-L
2009/3/3 Chas. Owens
> On Tue, Mar 3, 2009 at 14:47, Lauri Nikkinen
> wrote:
> > I uninstalled ActiveState Perl via Add/Remove Programs and i
t; > From: lauri.nikki...@gmail.com
> > [mailto:lauri.nikki...@gmail.com] On Behalf Of Lauri Nikkinen
> > Sent: Tuesday, March 03, 2009 12:10
> > To: Wagner, David --- Senior Programmer Analyst --- CFS
> > Cc: Perl Beginners
> > Subject: Re: Printing directory sizes
> >
> >
;
my $size;
find( sub { -f and ( $size += -s _ ) }, $dir );
~ > perl Print_directory_sizes.pl
invalid top directory at /System/Library/Perl/5.8.8/File/Find.pm line 592.
So, something is wrong here also...
Thank you for your help anyway...
-L
2009/3/3 Chas. Owens
> On Tue, Mar 3, 2009 at 1
Ok, I typed
C:\Perl>ppm query File
to see that there is no File::Find module installed. It seems that
ActiveState does not offer it via ppm, am I right?
2009/3/3 Lauri Nikkinen
> Thanks, how can I check if the module File::find is installed on my system?
> I can't locate i
auri.nikki...@gmail.com
> > [mailto:lauri.nikki...@gmail.com] On Behalf Of Lauri Nikkinen
> > Sent: Tuesday, March 03, 2009 11:38
> > To: Perl Beginners
> > Subject: Printing directory sizes
> >
> > Hi,
> >
> > I'm trying to print directory sizes using script
Hi,
I'm trying to print directory sizes using script from
http://coding.derkeiler.com/Archive/Perl/perl.beginners/2005-08/msg00693.html
and when I try it from the cmd.exe
C:\Perl>perl Print_directory_sizes.pl "C:/Temp"
but I get an error message saying
use of uninitialized value etc.
Whe
Hi,
Try these
use Text::CSV;
use Text::CSV_XS;
use Tie::Handle::CSV;
-L
2009/3/1 monnappa appaiah :
> Hi all,
>
> can somebody please suggest me a module to work with csv
> files...majority of the function i use manually is sort, unique, pivot
> table and also i shud be able to read
Thank you for your reply. Yes, I was also thinking that, thanks.
-L
2009/2/26 Yogesh Sawant :
>
> On Wed, Feb 25, 2009 at 6:14 PM, Lauri Nikkinen
> wrote:
>>
>> Hi,
>>
>> I wrote a script which copies files in directory to an another
>> directory based on
Hi,
I wrote a script which copies files in directory to an another
directory based on user input. Any suggestions to simplify or shorten
this? I'm using Win XP.
-L
code -
#!/bin/perl
use warnings;
use strict;
use File::Copy;
my $dire;
my $destinatio
f ($csv_line->{'Company'} =~ m/Middle./) {
print OUTFILE2 $csv_line->{'Surname'} . ": " .
$csv_line->{'Company'} . "\n";
}
}
close OUTFILE;
close OUTFILE2;
close $fh;
#==
2008/11/18 Raymond Wan <[EMA
Hello,
I would like to parse a .csv file and write certain records into two
separate files. The program below writes the records easily into the
csvtmp.csv but the second file is only created with no records
written. I cannot see the problem here, the second file is produced
easily if the first lo
Hello,
I would like to parse a .csv file and write certain records into two
separate files. The program below writes the records easily into the
csvtmp.csv but the second file is only created with no records
written. I cannot see the problem here, the second file is produced
easily if the first lo
;;
open OUTFILE, '>', $outfile or die "Unable to open $outfile: $!";
while(my @re = $sth->fetchrow_array) {
print OUTFILE @re,"\n";
}
close OUTFILE;
$sth->finish();
$dbh->disconnect();
-L
2008/11/8 Rob Dixon <[EMAIL PROTECTED]&
open
open OUTFILE, ">", $outfile or die "...";
# read the records line by line,and write them to the file
while(my @re = $sth->fetchrow_array) {
print OUTFILE @re,"\n";
}
close OUTFILE;
$sth->finish();
$dbh->disconnect();
2008/11/7 Jeff P. <[EMAI
Hello,
First post to this forum. I'm trying to retrieve data via DBI and
write it into a text file. Everything works fine with DBI but I don't
know how to write query results into my text file. My code is here:
##
#!/bin/perl
use warnings;
use strict;
use DBI;
my $dbs =
23 matches
Mail list logo