#!/usr/bin/perl -w use Cwd; my $dir = getcwd; my $dirs = "/opt/DSPKG"; opendir(BIN, $dirs) or die $!; open(MYFILE, ">/tmp/pkgtest") || die $!; while(my $checkDir = readdir(BIN)){ #test for the directory -- better than grep if(-d "$dirs"){ #print it to file unless it's the current or #previous directory entry, as you specified unless($dirs eq "." or $dirs eq ".."){ print MYFILE "$dirs\n"; } } } closedir(BIN); close(MYFILE);
In reply to Re: directory listing
by jrsimmon
in thread directory listing
by muizelaar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |