View Full Version : [SOLVED] BASH Script: Compare two directories, if they differ, run code
dmillerw
June 20th, 2010, 09:30 AM
Title pretty much explains it all, basically trying to figure out how to compare dir1 to dir2, if dir2 is different from dir1, copy missing files...that at all possible?
Thanks in advance
Paddy Landau
June 20th, 2010, 09:35 AM
Why not just copy the missing files?
cp --no-clobber dir1 dir2
dmillerw
June 20th, 2010, 09:40 AM
I...did not know that command existed...thanks!
Paddy Landau
June 20th, 2010, 09:45 AM
I...did not know that command existed...thanks!
The man command is your friend. I too did not know that the option existed until you asked the question.
I thought, "I wonder whether you can copy without overwriting?" I went to the terminal and entered:
man cpNice 'n' easy. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.