Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: Comparing Values PER Sub-folder

by Kenosis (Priest)
on Sep 05, 2012 at 02:12 UTC ( #991723=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Comparing Values PER Sub-folder
in thread Comparing Values PER Sub-folder

Yes, provided that the top dir contains *.txt files. You can try commenting out /\.txt$/ or return;, so all files are displayed. Another option is to initialize $dir with the complete path to the 'top' directory you want File::Find to traverse, in case '.' may not be working.


Comment on Re^5: Comparing Values PER Sub-folder
Select or Download Code
Re^6: Comparing Values PER Sub-folder
by omegaweaponZ (Beadle) on Sep 05, 2012 at 02:19 UTC
    Looks like I had some type of perl package mis-match. I was attempting to initialize File::Find::Rule on a prior test, which conflicted with something. I re-arranged something also in a different sub and it seems to be working just fine now. I think slurp is a good way to grab this, by setting these to a variable I think a simple comparison of directory to file lines should work well, but I will post again if something else seems to go astray. Thank you for your help!

      Great, omegaweaponZ--and you're very welcome!! Am glad you got it working!

        One more question!!!! Regarding the final component to this, I'm attempting to locate the best method to compare and contrast per directory, correct? So the print output would be something like this:

        Cur dir: /folder/blahA/blah1; Cur file: file.txt; Num Lines: 8
        Cur dir: /folder/blahA/blah2; Cur file: file.txt; Num Lines: 8
        Cur dir: /folder/blahA/blah3; Cur file: file.txt; Num Lines: 8
        Cur dir: /folder/blahA/blah4; Cur file: file.txt; Num Lines: 8
        Cur dir: /folder/blahA/blah5; Cur file: file.txt; Num Lines: 8
        Cur dir: /folder/blahA/blah6; Cur file: file.txt; Num Lines: 8

        Cur dir: /folder/blahB/blah1; Cur file: file.txt; Num Lines: 10
        Cur dir: /folder/blahB/blah2; Cur file: file.txt; Num Lines: 10
        Cur dir: /folder/blahB/blah3; Cur file: file.txt; Num Lines: 10
        Cur dir: /folder/blahB/blah4; Cur file: file.txt; Num Lines: 12
        Cur dir: /folder/blahB/blah5; Cur file: file.txt; Num Lines: 10
        Cur dir: /folder/blahB/blah6; Cur file: file.txt; Num Lines: 10

        So the offending folder of blahB has one text file that doesn't match up to the rest. How can I detect and alert on that? Basically, I want to set True if all num lines are equal to each other per directory and False if they don't

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-07-31 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (246 votes), past polls