I've created a script wherein it will compare the two files in different directory (rpms
and newrpms
). This two directory composed of files. in the rpms/
side it was the old version files and in the newrpms/
is the updated ones. So in this script, the main goal for this is that the files inside the directory will be compared, if there are same name files remove the older one and replace it with the updated file.
rpms/
-- the files inside of this directory
firefox-24.5.0-1.el5_10.i386.rpm
firefox-24.5.0-1.el5_10.x86_64.rpm
java-1.6.0-openjdk-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-demo-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-devel-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-javadoc-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-src-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.7.0-openjdk-1.7.0.55-2.4.7.1.el5_10.x86_64.rpm
java-1.7.0-openjdk-debuginfo-1.7.0.55-2.4.7.1.el5_10.x86_64.rpm
java-1.7.0-openjdk-devel-1.7.0.55-2.4.7.1.el5_10.x86_64.rpm
java-1.7.0-openjdk-javadoc-1.7.0.55-2.4.7.1.el5_10.x86_64.rpm
newrpms/
-- the updated files that needs to replace the old ones in the rpms/
directory
firefox-25.5.0-1.el5_10.i386.rpm
firefox-25.5.0-1.el5_10.x86_64.rpm
java-1.6.0-openjdk-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-demo-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-devel-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-javadoc-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
java-1.6.0-openjdk-src-1.6.0.0-5.1.13.3.el5_10.x86_64.rpm
Please see belows script.
for i in $(\ls -d ./rpms/*);
do diff ${i} newrpms/;
done
For the code above, nothing happens. Can anyone help me to solve my problem. All I want is to compare the two directory and get the the same files if and only if in the rpms/
directory don't have the same files that newrpms/
have it is very understandable to move it from the newrpms/
to rpms/
nad if ever that they have the same filename but have just little part are not the same. Check it the most updated one.
ex.
firefox-24.5.0-1.el5_10.i386.rpm --> in the rpms/
firefox-25.5.0-1.el5_10.i386.rpm --> in the newrpms/
so the most updated one is in the newrpms/
. remove the firefox-24.5.0-1.el5_10.i386.rpm
in the rpms/
and move the firefox-25.5.0-1.el5_10.i386.rpm
into rpms/