Re: newbie hlelp!

2003-09-16 Thread Carl Jolley
On Mon, 15 Sep 2003, $Bill Luebkert wrote:

 alex p wrote:

  Hello all,
 
  I am trying to figure out a way to get the last modified date of a file.
  I have looked at the following modules but they dont seem to address what i
  need:  stat, utime, opendir
 
  does anyone know how to go about getting this date?

 stat should be fine :  my $mtime = (stat $path)[9];


And then to convert the $mtime to something useful, give it to
localtime(), e.g.

@date_fields=localtime($mtime);
   OR
$The_last_mod_time=scalar localtime($mtime);

 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread Lee Goddard
At 21:41 15/09/2003, alex p wrote:
Hello all,

I am trying to figure out a way to get the last modified date of a file.
I have looked at the following modules but they dont seem to address what 
i need:  stat, utime, opendir
opendir opens a directory so the contents can be listed.
utime changes the modification times associated with the file.
stat will give you the last modified time (as will -M).
warn -M $file;
warn ((stat ($file))[9])
hth
lee





Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Can I unzip with perl a WinZip does had a password ?

2003-09-16 Thread joachim . goerner
Hi all,

Can I extract with perl a WinZip-file which is protected with a password ?

I looked in 'Archive::Zip' and can find no password-parameter.

Best regards/Mit freundlichen Grüssen 
Joachim Görner 

Informationsverarbeitung Systemtechnik Basisdienste (ISB) 
ADAC e.V., Am Westpark 8, 81373 München 
Tel.: (089) 76 76 27 83 Fax: (089) 76 76 28 82 
mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  
www.adac.de www.adac.de  



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread alex p
Thank you all for replying, I am using the code below and I am still unable 
to get the correct date
code
opendir (DIR, $server\\c\$\\sys\\data\\LOG\\updates);
 @allfiles = readdir(DIR);
 #print(, readdir(DIR));
 #closedir(DIR);
 foreach $f (@allfiles)
 	{
	  unless ( ($f eq .) || ($f eq ..) )
		{
		  print $f\n;
		  (undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
		  $mon++;
		  $year += 1900;
		  $dateval = printf(%04d%02d%02d\n,$year,$mon,$dom);
  }
/code
the output of printf is: 19691231  for every file?
what am I doing wrong?
the date should be yesterdays date 20030915

TYAVM

From: Carl Jolley [EMAIL PROTECTED]
To: $Bill Luebkert [EMAIL PROTECTED]
CC: alex p [EMAIL PROTECTED], 
[EMAIL PROTECTED]
Subject: Re: newbie hlelp!
Date: Tue, 16 Sep 2003 01:49:48 -0400 (EDT)

On Mon, 15 Sep 2003, $Bill Luebkert wrote:

 alex p wrote:

  Hello all,
 
  I am trying to figure out a way to get the last modified date of a 
file.
  I have looked at the following modules but they dont seem to address 
what i
  need:  stat, utime, opendir
 
  does anyone know how to go about getting this date?

 stat should be fine :  my $mtime = (stat $path)[9];


And then to convert the $mtime to something useful, give it to
localtime(), e.g.
@date_fields=localtime($mtime);
   OR
$The_last_mod_time=scalar localtime($mtime);
 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_
Express yourself with MSN Messenger 6.0 -- download now! 
http://www.msnmessenger-download.com/tracking/reach_general

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: newbie hlelp!

2003-09-16 Thread Arms, Mike
Lee Goddard ([EMAIL PROTECTED]) wrote:
 opendir opens a directory so the contents can be listed.
 utime changes the modification times associated with the file.
 stat will give you the last modified time (as will -M).
 
 warn -M $file;
 warn ((stat ($file))[9])


Trevor Joerges ([EMAIL PROTECTED]) wrote:
 Try perldoc -f -M.
 
 my $modtime = -M file; # will get you the last modified time in days.

A correction for Lee and Trevor. The -M function is not 
the same as  (stat $file)[9] which is what the original
poster wanted (i.e. mtime of a file).

Here is the section from perldoc -f -M :

   -M  Age of file in days when script started.

Let's try it. I have two files in my current dir doit.bat and doit.sh:

   ls -l doit.*
  -rwxr-xr-x1 marmspwrusers 1360 Feb  6  2003 doit.bat
  -rwxr-xr-x1 marmspwrusers 1502 Jul 17 11:27 doit.sh

So I run this test:

  perl -e 'for (@ARGV) { print $_ : -M=, -M $_,   mtime=, (stat $_)[9],
\n }' doit.*

Produces this as output:

  doit.bat : -M=222.013171296296  mtime=1044548597
  doit.sh : -M=60.9687268518519  mtime=1058462837

Hope this helps.

--
Mike Arms


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread Dirk Bremer \(NISC\)
- Original Message - 
From: alex p [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 11:42
Subject: Re: newbie hlelp!


 Thank you all for replying, I am using the code below and I am still
unable
 to get the correct date
 code
 opendir (DIR, $server\\c\$\\sys\\data\\LOG\\updates);
   @allfiles = readdir(DIR);
   #print(, readdir(DIR));
   #closedir(DIR);
   foreach $f (@allfiles)
   {
   unless ( ($f eq .) || ($f eq ..) )
 {
   print $f\n;
   (undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
   $mon++;
   $year += 1900;
   $dateval = printf(%04d%02d%02d\n,$year,$mon,$dom);
}
 /code
 the output of printf is: 19691231  for every file?
 what am I doing wrong?
 the date should be yesterdays date 20030915


Alex,

I found that the method that worked best for me in a similar circumstance
was to parse the output of the DOS dir command.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471

[EMAIL PROTECTED]
www.nisc.cc

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread michael higgins
[EMAIL PROTECTED] wrote:

Thank you all for replying, I am using the code below and I am still 
unable to get the correct date
code
opendir (DIR, $server\\c\$\\sys\\data\\LOG\\updates);
 @allfiles = readdir(DIR);
 #print(, readdir(DIR));
 #closedir(DIR);
 foreach $f (@allfiles)
   {
 unless ( ($f eq .) || ($f eq ..) )
   {
 print $f\n;
 (undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
 $mon++;
 $year += 1900;
 $dateval = printf(%04d%02d%02d\n,$year,$mon,$dom);
  }
/code
the output of printf is: 19691231  for every file?
what am I doing wrong?
the date should be yesterdays date 20030915

[snip]
--
Maybe you need to stat the file in the dir..??

HTH

-- mike higgins



$dir = $server\\c\$\\sys\\data\\LOG\\updates;
opendir (DIR, $dir) or die $!;
.
.
.
localtime((stat($dir/$f))[9]);


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread $Bill Luebkert
alex p wrote:

 Thank you all for replying, I am using the code below and I am still unable 
 to get the correct date
 code
 opendir (DIR, $server\\c\$\\sys\\data\\LOG\\updates);
   @allfiles = readdir(DIR);
   #print(, readdir(DIR));
   #closedir(DIR);
   foreach $f (@allfiles)
   {
 unless ( ($f eq .) || ($f eq ..) )
   {
 print $f\n;
 (undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
 $mon++;
 $year += 1900;
 $dateval = printf(%04d%02d%02d\n,$year,$mon,$dom);
}
 /code
 the output of printf is: 19691231  for every file?
 what am I doing wrong?
 the date should be yesterdays date 20030915

The following works fine for me (modified the dir for testing):

use strict;

#opendir DIR, $server\\c\$\\sys\\data\\LOG\\updates or die opendir: $!;
opendir DIR, . or die opendir: $!;
my @allfiles = readdir DIR;
closedir DIR;

foreach my $f (@allfiles) {
next if $f =~ /^\.{1,2}$/;
my ($dom, $mon, $year) = (localtime ((stat $f)[9]))[3,4,5];
printf $f: %04d%02d%02d\n, $year+1900, $mon+1, $dom;
}

__END__

Your version also worked with minimal additions for scoping, etc.
Maybe there's a problem using the share - try a local filesystem and
see if it makes a difference.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Can I unzip with perl a WinZip does had a password ?

2003-09-16 Thread Gerber, Christopher J
 -Original Message-
 From: Steven Manross [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 16, 2003 12:47 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: Can I unzip with perl a WinZip does had a password ?
 
 
 The Archive::Zip module does not currently create or extract encrypted
members.
 
 No passwords...
 
 :(
 
 You might try to script it using the pkunzip.exe and a system(pkunzip
blah blah blah) command...

You might also try calling WinZip externally using the following:

  Extracting Files

  The command format is: 
winzip32 -e [options] filename[.zip] folder

  where -e is required. 

  options
-o and -j stand for Overwrite existing files without prompting and 
Junk pathnames, respectively. Unless -j is specified, folder
information is used. Use -sPassword to specify a case-sensitive
password. The password can be enclosed in quotes, for example, 
-sSecret Password. 

  filename.zip
Specifies the name of the Zip file involved. Be sure to specify the
full filename (including the folder). 

  folder
Is the name of the folder to which the files are extracted. If the
folder does not exist it is created. 

Here's some quick, untested code to try...

code
my $Prog = $ENV{ProgramFiles}.'\\WinZip\\WINZIP32.exe';
my $Password = 'Secret Password';
my $ZIP  = 'filename.zip';
my $Path = 'c:\\my\\folder';
system($Prog -e -s\$Password\ \$Zip\ \$Path\);
/code

Chris


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. 
It is intended for the addressee(s) only. Access to this E-mail by anyone else is 
unauthorized. If you are not an addressee, any disclosure or copying of the contents 
of this E-mail or any action taken (or not taken) in reliance on it is unauthorized 
and may be unlawful. If you are not an addressee, please inform the sender immediately.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread $Bill Luebkert
Lee Goddard wrote:

A correction for Lee and Trevor. The -M function is not
the same as  (stat $file)[9] which is what the original
poster wanted (i.e. mtime of a file).
 
 
 You're right of course: not a very good mnemonic.
 And whilst I'm showing my ignorance, can someone
 please explain to me why stat needs so many brackets?
 Same for localtime. I understand both functions can
 return a scalar or an array - but what's with the
 brackets...? Is there a logic?

There is only one set of brackets there (asking for the 10th element in
the stat return array.  The parens are needed to make sure the brackets
are applied to the results of stat rather than treating $file[9] as an
array element to be used as an argument to stat.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newbie hlelp!

2003-09-16 Thread Carl Jolley
On Tue, 16 Sep 2003, alex p wrote:

 Thank you all for replying, I am using the code below and I am still unable
 to get the correct date
 code
 opendir (DIR, $server\\c\$\\sys\\data\\LOG\\updates);
   @allfiles = readdir(DIR);
   #print(, readdir(DIR));
   #closedir(DIR);
   foreach $f (@allfiles)
   {
 unless ( ($f eq .) || ($f eq ..) )
   {
 print $f\n;
 (undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
 $mon++;
 $year += 1900;
 $dateval = printf(%04d%02d%02d\n,$year,$mon,$dom);
}

That's probably because the files in @allfiles are not in your current
directory. Either prepend the directory to the front of each file
you stat or chdir to the directory.

 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs