readdir() works a treat tho.. funny how the -d and -f does not always work and I see most files and folders listed in the else
because windows folders usually don't have extensions and files usually do have extensions this concept could be used in a controlled environment to recurse through all folders (things with no extension)sub recurseDir2 { opendir(DIR, $_[0]); my @temp = readdir(DIR); closedir DIR; #my @temp = (glob $_[0]); foreach (@temp) { if (-d $_) { print "Directory: $_" , "\n" ; recurseDir2("$_/*"); } elsif (-f $_) { print "File: $_ \n"; }else{ print "Other: $_ \n"; } } } recurseDir2('c:/'); ---8<--- Other: deleteme.htm Other: I386 Other: DISCOVER Other: AUTOEXEC.BAT Other: CONFIG.SYS Other: deleteme.gif Other: BOOTLOG.TXT Other: WINDOWS Other: casa_gms.zip Other: Answer.txt Other: Recycled Other: sacoss_crm.zip Other: convert_rarossa.zip Other: mpcsetup.log File: console.zip Directory: data ---8<---
___ /\__\ "What is the world coming to?" \/__/ www.wolispace.com
In reply to Re: Re: Recursive sub
by wolis
in thread Recursive sub
by pen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |