views:

155

answers:

4

Let's say I have a script that generates incrementing folder names over time (100, 101, 102, 103, 104, etc...). These folders are synced between machines and there is a chance of creation failure for any given folder on system 2.

System 1 is always in sync: 100/ 101/ 102/ 103/ 104/ etc...

System 2 may have errors: 100/ 102/ 103/ etc...

(as you can see, 101/ & 104/ are missing on system 2)

How can I generate a list of all the missing folders on System 2?

P.S. Rsync is not really an option because the actual number of folders is incredibly high.

+2  A: 

You can pipe the contents of ls on each machine to a file, and then diff the two files. You can also use the command comm to show lines that are only in one file, and not in the other.

Mark Byers
ls should keep things sorted, but just in case it isn't or the sorting is different on the two hosts, you can pipe the output to sort.
Suppressingfire
A: 

just generate a list of successful creations as they occur

ennuikiller
+1  A: 

You could do something like this:

% ls -1 System1 > ls.System1            # Use the -1 flag to ensure 1 dir per line
% ls -1 System2 > ls.System2
% comm -23 ls.System1 ls.System2
101
104

The comm command can show you what is common to both, unique to f1, or unique to f2:

comm -12 f1 f2  # common to both
comm -23 f1 f2  # unique to f1
comm -13 f1 f2  # unique to f2
unutbu
A: 

you can use diff. assuming you had already mapped system2 to a path

diff system1/path system2/path
ghostdog74