Ok tested that theory and it is exactly what it is doing. That is not a
good thing. How can I force it to read the directory based on file date
instead of the way windows last sorted it. That does not seem right to
me that it would function like this.

-----Original Message-----
From: Paul Kraus [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 2:36 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Read dir / sort


WTF now its working with no changes to the program......
This is very frustrating.
Is perl some how looking at the way the directory was last sorted in my
Ms window even though its pulling it from a UNIX server?

-----Original Message-----
From: Paul Kraus [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 2:30 PM
To: [EMAIL PROTECTED]
Subject: Read dir / sort


I have a program that would read a directory and then do some renaming.
Up until recently it always seem to read by oldest file first to newest.
Which is great because my renaming involves incrementing a counter and
placing that count in each file. So if the order was changed the program
will break. Which it did.

So two questions why is it reading the directories different now? How
can I have it read the directory with oldest file first.

Here is the sub routine.

sub getfiles {
  my ($amcount, $pmcount);
  opendir ( DH, '//sco1/pm6/reports') or die ("Can not open
directory\n");
  foreach ( readdir (DH) ) {
    next unless /^Sj/;
    print "$_\n";
    #&changefilename( ( stat( "//sco1/pm6/reports/$_" ) ) [9], $_ );
  }
  die;
   foreach (keys %files){
    my $counter;
    foreach ( @ { $files {$_} } ) {
      $counter++;
      $_->[1] =~ s/_/_($counter)_/;
      print "$_->[1]\n";
#      rename "//sco1/pm6/reports/$_->[0]", "./$_->[1]" or die ( "NO!
$!\n" );
    }
  }
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to