home | list info | list archive | date index | thread index

[OCLUG-Tech] stupid bash question

To: alayne [ at ] twobikes [ dot ] ottawa [ dot ] on [ dot ] ca
Subject: [OCLUG-Tech] stupid bash question
In-Reply-To: <alpine [ dot ] DEB [ dot ] 2 [ dot ] 00 [ dot ] 0903141614170 [ dot ] 13453 [ at ] bent [ dot ] twobikes [ dot ] ottawa [ dot ] on [ dot ] ca>
References: <alpine [ dot ] DEB [ dot ] 2 [ dot ] 00 [ dot ] 0903141614170 [ dot ] 13453 [ at ] bent [ dot ] twobikes [ dot ] ottawa [ dot ] on [ dot ] ca>
X-Mailer: VM 8.0.9 under Emacs 22.2.1 (i486-pc-linux-gnu)
FCC: ~/Mail/outgoing
--text follows this line--
alayne [ at ] twobikes [ dot ] ottawa [ dot ] on [ dot ] ca writes:
| I have two directories which are mostly the same. I need to compare the 
| files in them (using cmp) to confirm this.
| 
| Unfortunately, some of the files (which Other People created, not me) have 
| blanks in the filenames.
| 
| I thought I could just go
| 
| for i in `cat ListOfFiles`
| do
| cmp $i $OtherDirectory/$i
| done
| 
| but it fails on all files with blanks in them.
| 
| If I edit ListOfFiles to put \ (or \\) before the blanks, that doesn't 
| work any better (although that worls on an ordinary command line. 
| Neither does putting "" around the filenames in the cmp.
| 
| Does anyone have any better suggestions? I'm obviously missing something.

Hi Alayne,
How about this?

    rsync -n --delete -av $thisdir $otherdir

Without the '-n' it would make the directories the same.
With the '-n' it will just tell you which files would be copied, the
ones that are different.

However, it might be noisy if ListOfFiles is a small subset of the
rest of the directory.

roland