0

Unlike many of the file and directory comparison utilities out there, including diff, I've only seen literal file to file (sometime, more than two files) and directory to directory comparisons.

I'm looking for a way to compare the contents of directory against the line-by-line contents of a text file. Basically, I have an index file with all the directory listings listed line by line and I'd like to compare/diff that against an actual data directory and get the results (missing files) listed.

Anyone know of a tool/utility that can get this done? I'm open to any suggestions or advice that point me in the direction too, any and all help is appreciated, I'm more than happy to script it up with a variety of commands if someone sees that as a solution, although an existing application would be best.

1
  • How was the file originally generated?
    – Zoredache
    Commented Mar 24, 2015 at 22:13

1 Answer 1

2

Lets say I had a directory /srv and a few weeks ago I ran a command like find /srv/ > /tmp/oldindex.

You could easily compare that against the current system using process substitution by doing something like this.

diff -u /tmp/oldindex <(find /srv/)

There are lots of options you could use to change your diff format. You will need to generate your before and after indexes the same way, or you will need to manipulate them with some tools.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .