Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list directories

Status
Not open for further replies.

perlnewb00

Programmer
Joined
Nov 13, 2006
Messages
3
Location
US
I need to list all folders in a current dirctory non-recursivly and print the last modified date for that folder. I found a script that works but I need it written in such a way I can perform other actions if a folder is found. I am not very used to this method of if-then-else and would prefer it written in this format
if(found){
process
}else next

This is the current script:
my $dir = '\mydir;
opendir my $dh, $dir or die "Cannot open '$dir' $!";
print "$dir \n",
map !/\A\.\.?\z/ && -d "$dir/$_" ? "$dir/$_ ".ctime(stat("\mydir\$_")->mtime)." \n" : (),
readdir $dh;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top