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]