Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

perl, how to compare file contents from one folder to another

Posted on 2011-09-19
3
Medium Priority
?
362 Views
Last Modified: 2012-05-12
There are 3 files in dir1.  I want to check if the 3 files are the same in dir2, so the three files exist in dir2 and have the same exact content.  Note, dir2 may have other files.
0
Comment
Question by:rgbcof
3 Comments
 
LVL 12

Expert Comment

by:tel2
ID: 36565712
How about a recursive diff:
    diff -r dir1 dir2
0
 
LVL 4

Accepted Solution

by:
Ryan Weaver earned 2000 total points
ID: 36566237
You could use the File::Dircmp module to find the file name differences and combine that with File::Compare to check the files of the same name.
0
 

Author Closing Comment

by:rgbcof
ID: 36568516
Fryguy,

Thanks for the tip.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question