![]() |
|
No such thing as a small change | |
PerlMonks |
Re: Finding un-paired files in a directoryby Anonymous Monk |
on Dec 02, 2003 at 19:01 UTC ( #311714=note: print w/replies, xml ) | Need Help?? |
You want the "*.did" files that have no corresponding ".mrg" file, right?
Hmmm... let me type something in here... This code takes advantage of the fact that you will have only one or two files with the same basename (and that there are only two extensions of interest). So, just count them up. It doesn't handle the case of a lone ".mrg" file. To fix that... The beauty of these code snippets (actually, they are working scripts) is that they don't do any filetests. File::Find (or readdir if you prefer) have already established the existence of the files -- checking for that again just slows down your code. :) -Dave
In Section
Seekers of Perl Wisdom
|
|