James Bond
12-17-2002, 04:52 PM
Ok, here is my problem, I have been trying for a while to write a scripte that runs and based on the current directory, gets a list of all subdirectories and trys to open.
I know the file name will the 'srquote' so, that isn't a puzzle. I had it working with several files as long as they were all in the same directory, but, when I try to open them up in different directories, nothing works. Here is my single directory version, any ideas anyone?
thanks
-JB
#!/usr/sbin/perl
@list=qx{ls};
open(OUTF,">>quote.txt");
flock(OUTF,2);
foreach $entry (@list) {
$entry =~ tr/'\n'/'\0'/;
open(INF, $entry) or die("Couldn't open file: $!");
seek(OUTF,0,2);
foreach $line (@a){
print OUTF "$line";
print "$line should be here";
}
close(INF);
}
close (OUTF);
print "all done, I think\n\n";
I know the file name will the 'srquote' so, that isn't a puzzle. I had it working with several files as long as they were all in the same directory, but, when I try to open them up in different directories, nothing works. Here is my single directory version, any ideas anyone?
thanks
-JB
#!/usr/sbin/perl
@list=qx{ls};
open(OUTF,">>quote.txt");
flock(OUTF,2);
foreach $entry (@list) {
$entry =~ tr/'\n'/'\0'/;
open(INF, $entry) or die("Couldn't open file: $!");
seek(OUTF,0,2);
foreach $line (@a){
print OUTF "$line";
print "$line should be here";
}
close(INF);
}
close (OUTF);
print "all done, I think\n\n";