Solved

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

Posted on 2011-09-19
3
349 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

679 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