Hi James,
please reply to all recipients.
On Fri, 8 Apr 2016 10:47:57 +0100
James Kerwin wrote:
> Good morning/afternoon all (depending on where you are),
>
> This should be a quick one:
>
> When creating files in a perl script is there a way to limit the size of
> the file created? If somebo
Hello:
On Sat, Dec 31, 2011 at 02:56:50AM +0200, Igor Dovgiy wrote:
> $filedata{$_} = [$filesize, $filemd5];
*snip*
> my ($size, $md5) = @{ $filedata{$filename} };
Alternatively, store a nested hash-reference:
$filedata{$File::Find::name} = {
md5 => $file_md5,
size => $file_s
Hi folks, happy new year to everyone. )
John, you're right, of course. ) The filenames in nested directories could
well overlap, and using $File::Find::name would be safer.
Didn't think of that as a big problem, though, as original script (with
'opendir') ignored all the nested folders overall.
J
On Sat, Dec 31, 2011 at 4:29 AM, John W. Krahn wrote:
> Igor Dovgiy wrote:
>
>> Great work, Jonathan!
>> Notice how simple your script has become - and that's a good sign as well
>> in Perl. :) We can make it even simpler, however.
>>
>> As you probably know, Perl has two fundamental types of col
Igor Dovgiy wrote:
Great work, Jonathan!
Notice how simple your script has become - and that's a good sign as well
in Perl. :) We can make it even simpler, however.
As you probably know, Perl has two fundamental types of collections: arrays
(where data is stored as a sequence of elements, data c
Great work, Jonathan!
Notice how simple your script has become - and that's a good sign as well
in Perl. :) We can make it even simpler, however.
As you probably know, Perl has two fundamental types of collections: arrays
(where data is stored as a sequence of elements, data chunks) and hashes
(wh
On Fri, Dec 30, 2011 at 7:11 PM, Brandon McCaig wrote:
> On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote:
> > Hi All
>
> Hello Jonathan:
>
> (Disclaimer: I stayed up all night playing Skyrim and am running
> on about 4.5 hours of sleep.. ^_^)
>
> I think most things have already b
On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote:
> Hi All
Hello Jonathan:
(Disclaimer: I stayed up all night playing Skyrim and am running
on about 4.5 hours of sleep.. ^_^)
I think most things have already been addressed, but I think Igor
might have had a bit of trouble making i
On Fri, Dec 30, 2011 at 11:58 AM, Igor Dovgiy wrote:
> Hi John, yes, good point! Totally forgot this. ) Adding new files to a
> directory as you browse it is just not right, of course. Possible, but not
> right. )
>
> I'd solve this by using hash with filenames as keys and collected 'result'
> st
Hi John, yes, good point! Totally forgot this. ) Adding new files to a
directory as you browse it is just not right, of course. Possible, but not
right. )
I'd solve this by using hash with filenames as keys and collected 'result'
strings (with md5 and filesizes) as values, filled by File::Find tar
Hi Jonathan,
Argh, really stupid mistake by me. ) But let's use it to explain some
points a bit further, shall we?
A skilled craftsman knows his tools well, and Perl programmer (with CPAN as
THE collection of tools of all sizes and meanings) has an advantage here: even
if documentation is a bit va
Jonathan Harris wrote:
FInally, I was advised by a C programmer to declare all variables at the
start of a program to avoid memory issues
Is this not necessary in Perl?
It is not really necessary in C either.
John
--
Any intelligent fool can make things bigger and
more complex... It takes
Jonathan Harris wrote:
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
Igor made a lot of good points. Here are my two cents worth. You are
using the File::Find module to traverse the file system and add new files
along the way. This _may_ cause problems on some file systems. It would
On Fri, Dec 30, 2011 at 12:33 AM, Jonathan Harris
wrote:
>
>
> On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
>
>> Jonathan Harris wrote:
>>
>>>
>>> Hi Igor
>>>
>>> Many thanks for your response
>>>
>>> I have started reviewing the things you said
>>> There are some silly mistakes in there
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote:
> Jonathan Harris wrote:
>
>>
>> Hi Igor
>>
>> Many thanks for your response
>>
>> I have started reviewing the things you said
>> There are some silly mistakes in there - eg not using closedir
>> It's a good lesson in script vigilance
>>
>> I
Jonathan Harris wrote:
Hi Igor
Many thanks for your response
I have started reviewing the things you said
There are some silly mistakes in there - eg not using closedir
It's a good lesson in script vigilance
I found the part about opening the file handle particularly interesting
I had no idea
On Thu, Dec 29, 2011 at 5:08 PM, Igor Dovgiy wrote:
> Hi Jonathan,
>
> Let's review your script a bit, shall we? )
> It's definitely good for a starter, but still has some rough places.
>
> #!/usr/bin/perl
>> # md5-test.plx
>> use warnings;
>> use strict;
>>
> use File::Find;
>>
> use Digest::MD
Hi Jonathan,
Let's review your script a bit, shall we? )
It's definitely good for a starter, but still has some rough places.
#!/usr/bin/perl
> # md5-test.plx
> use warnings;
> use strict;
>
use File::Find;
>
use Digest::MD5;
> use File::Spec;
>
So far, so good. )
> my $dir = shift || '/Users/j
Hi All
Firstly, many thanks for your help previously (19/12/11) - it has led to
making a useable script
I don't think it's brilliantly written, it seems a little bodged together
to me... but works fine - not a bad result for a first script
If you are new to this problem and are interested in
On Mon, Dec 19, 2011 at 8:09 PM, Shlomi Fish wrote:
> Hi Jonathan,
>
> some comments on your code - both positive and negative.
>
> On Mon, 19 Dec 2011 19:32:10 +
> Jonathan Harris wrote:
>
> > Hi Perl Pros
> >
> > This is my first call for help
> >
> > I am a totally new, self teaching, Per
On Mon, Dec 19, 2011 at 8:08 PM, Jim Gibson wrote:
> On 12/19/11 Mon Dec 19, 2011 11:32 AM, "Jonathan Harris"
> scribbled:
>
> > Hi Perl Pros
> >
> > This is my first call for help
> >
> > I am a totally new, self teaching, Perl hopeful
> >
> > If my approach to this script is simply wrong, pl
Hi Jonathan,
some comments on your code - both positive and negative.
On Mon, 19 Dec 2011 19:32:10 +
Jonathan Harris wrote:
> Hi Perl Pros
>
> This is my first call for help
>
> I am a totally new, self teaching, Perl hopeful
>
> If my approach to this script is simply wrong, please le
On 12/19/11 Mon Dec 19, 2011 11:32 AM, "Jonathan Harris"
scribbled:
> Hi Perl Pros
>
> This is my first call for help
>
> I am a totally new, self teaching, Perl hopeful
>
> If my approach to this script is simply wrong, please let me know as it
> will help my learning!
>
> The script aims
Hi Perl Pros
This is my first call for help
I am a totally new, self teaching, Perl hopeful
If my approach to this script is simply wrong, please let me know as it
will help my learning!
The script aims to:
1) Read in a directory either from the command line, or from a default path
2) Produce
San wrote:
Is there any way to limit the file size while zipping using
Archive::Zip so that it will stop processing a zip operation on a file
list when it crosses the maximum file size.
Hey San
Unfortunately Archive::Zip requires that an archive be written to disk
before the compression is pe
And the clouds parted, and Brian Gerard said...
>
> [1] http://www.alcyone.com/max/reference/physics/binary.html
> -anyone remember offhand the URL to the /. story on these, btw?
>
...never mind. Found it. (uncaught typo on my first google query... DOH!)
http://slashdot.org/articles/99/
SilverFox <[EMAIL PROTECTED]> wrote:
:
: I haven't put anything together as yet. Putting
: some if/elsif statement together would be the
: easiest way I can think off. Something like:
We can see a few problems right off. All scripts
should start with 'strict' and 'warnings'. We need a
consi
And the clouds parted, and SilverFox said...
>
> Hi all, I'm trying to writing a script that will allow a user to enter a
> number and that number will be converted into KB,MB or GB depending on the
> size of the number. Can someone point me in the right direction?
>
> Example:
> user enter: 59
Quickest wya would be to get the left over from begining.
...
print "Please enter your number:\n";
chomp($num=);
$bytes = $num % $kilo;
$num -= $bytes
...
HTH,
Mark G.
- Original Message -
From: SilverFox <[EMAIL PROTECTED]>
Date: Monday, August 9, 2004 12:06 pm
Subjec
Jose Alves De Castro wrote:
> On Mon, 2004-08-09 at 14:53, David Dorward wrote:
>> On 9 Aug 2004, at 14:34, SilverFox wrote:
>>
>> > Hi all, I'm trying to writing a script that will allow a user to enter
>> > a
>> > number and that number will be converted into KB,MB or GB depending on
>> > the
>
On Mon, 9 Aug 2004, SilverFox wrote:
Example:
user enter: 59443
Script will output: 58M
I know this isn't getting into the spirit of things, but have you
considered simply using the `units` program?
% units
500 units, 54 prefixes
You have: 59443 bytes
You want: megabytes
On Mon, 2004-08-09 at 14:53, David Dorward wrote:
> On 9 Aug 2004, at 14:34, SilverFox wrote:
>
> > Hi all, I'm trying to writing a script that will allow a user to enter
> > a
> > number and that number will be converted into KB,MB or GB depending on
> > the
> > size of the number. Can someone
On 9 Aug 2004, at 14:34, SilverFox wrote:
Hi all, I'm trying to writing a script that will allow a user to enter
a
number and that number will be converted into KB,MB or GB depending on
the
size of the number. Can someone point me in the right direction?
What have you got so far? Where are you st
"Vasudev.K." wrote:
> Hi,
> I have this rather critical problem, I am trying to download quite huge
> files from a remote server through ftp. (The file being in a zipped
> format). I have an array which stores the names of the files to be
> downloaded. I am opening each of them up at my end and ex
Ya.. I guess .. I got a part of the answer..
I am unzipping it onto the STDOUT and reading it from there
But... still stuck with parallel processing :p:D
-Original Message-
From: Vasudev.K. [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 1:06 PM
To: [EMAIL PROTECTED]
Subject
-Original Message-
Vasudev.K. wrote:
.
>>>Q1. After unzipping, the file is huge (even the zipped one is :(( )..
>>>almost 5GB. The system throws an error"File too large" and exits.
>>>How do I get around this ache? One way I want to do it is unzipped file
>>>into many parts
Hi,
But i
tried this i didn't $size= -s $filename but it didn't work, anyways i want
my upload script not to upload files that are bigger than 250Kb
Anthony
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Feb 22, Chris Ball said:
>> "Anthony" == awards writes:
>
>Anthony> Hi, I have an upload script, and i want to check the file
>Anthony> size before it uploads.
>
>The stat() function returns a list that includes file size as the
>seventh element. You can use:
>
> $size = (stat
> "Anthony" == awards writes:
Anthony> Hi, I have an upload script, and i want to check the file
Anthony> size before it uploads.
The stat() function returns a list that includes file size as the
seventh element. You can use:
$size = (stat($filename))[7];
... to retrieve the
anthony wrote:
>
> Hi,
>
> I have an upload script, and i want to check the file size before it
> uploads.
>
> Any suggestion is appreciated
>
> Anthony
>
here's some old code that does that, might be something built-in in
CGI.pm as well:
my $tempFile = CGI::tmpFileName($img_filename);
Upload via FTP? Via a web based form? 18 questions left...
John
-Original Message-
From: anthony [mailto:[EMAIL PROTECTED]]
Sent: 22 February 2002 14:22
To: [EMAIL PROTECTED]
Subject: file size
Hi,
I have an upload script, and i want to check the file size before it
uploads.
Any sugg
$filename = "server\\c\$\\boot.ini";
if (-e $filename) { # If file specified in filename exists
$size = (stat $filename)[7];
print "$filename is $size bytes in size\n";
} else {
print "$filename does not exist\n";
}
-Original Message-
From: [EMAIL PROTECTED] [
#!/usr/bin/perl
#
# Name:statdemo.pl
# Author: Chris Hedemark <[EMAIL PROTECTED]>
# Purpose: Demonstrate use of the stat() function.
# Usage:perl statdemo.pl filename1 filename2 filename3...
if (!@ARGV) {
die "No arguments!\n";
}
for ($i = 0; $i < @ARGV.""; ++$i) {
if (-e $ARGV[
use the stat command.
[EMAIL PROTECTED] wrote:
> Hi,
>
> I would like to know if with a perl script you can get the size of a file ?
> I need to get all the size of 250 files on 250 computers ...
>
> thanx
-s
as in:
perl -e 'print "$_: " . -s . "\n" for (glob ("*.*"))'
> Hi,
>
> I would like to know if with a perl script you can get the size of a
file ?
> I need to get all the size of 250 files on 250 computers ...
>
> thanx
45 matches
Mail list logo