You were an excellent partner in every way. You delivered your commitments on time, you provided clear guidance on what you needed from me, why you needed it, and when my communication was not sufficient you asked for clarification.

919-341-5170

help@ideacode.com

 

Blazing a trail to better facilities management.

Linux

Finding files common amongst two (or more) directories

I've been preparing for a conference next week, so I haven't had much time to write.  This week, I'll leave you with a little useful command line fu.

The problem: you have two directories, called v1 and v2.  v2 is mostly like v1, except there are maybe some new files in v2 or v1 has files v2 doesn't.  The need: list the files that appear in both.

find v[12] -type f | cut -f 2- -d / | sort | uniq -c | grep '^      2'

Which finds all files in "v1" and "v2", removes the leading directory part, sorts them in order to count how many times each line appears, and limits to those that appear twice.

Syndicate content