This is a discussion on Listing changed files between directories within the Linux General forums, part of the Linux Forums category; I have two directories: /home/rose_garden/abs/core and /var/abs/core they both contain directories like this acl/ +-----PKGBUILD ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have two directories: /home/rose_garden/abs/core and /var/abs/core they both contain directories like this acl/ +-----PKGBUILD atl2/ +-----PKGBUILD etc /var/abs/core is rsynced from ArchLinux repos. and /home/rose_garden/abs/core is my work area. When Arch changes or updates the PKGBUILD file I would like to get a list of changed files so I can rebuild my files based in /home/rose_garden/abs/core Simply rsync between the two directories won't work as I need to make some changes before using the "new/updated" PKGBUILD file. I would also like to include any new files that don't reside in /home/rose_garden/abs/core but are in /var/abs/core as they represent new software packages placed into the repos. I would like the list to contain only the files that where updated or changed. Comparing /var/abs/core/acl/PKGBUILD to /home/rose_garden/abs/core/acl/PKGBUILD and if /var/abs/core/acl/PKGBUILD changes place an entry into a file as in /var/abs/core/acl/PKGBUILD updated or something similar. I tried diff but it did not work out as there was too much data I am looking for just a simple list. Thanks |
|
|||
|
On Saturday 30 August 2008 14:53, Baho Utot wrote:
> > I have two directories: > > /home/rose_garden/abs/core and /var/abs/core > > they both contain directories like this > > acl/ > +-----PKGBUILD > atl2/ > +-----PKGBUILD > etc > > /var/abs/core is rsynced from ArchLinux repos. > and /home/rose_garden/abs/core is my work area. > > When Arch changes or updates the PKGBUILD file I would like to get a list > of changed files so I can rebuild my files based in > /home/rose_garden/abs/core Simply rsync between the two directories won't > work as I need to make some changes before using the "new/updated" > PKGBUILD file. > > I would also like to include any new files that don't reside > in /home/rose_garden/abs/core but are in /var/abs/core as they represent > new software packages placed into the repos. > > I would like the list to contain only the files that where updated or > changed. > > Comparing > /var/abs/core/acl/PKGBUILD to /home/rose_garden/abs/core/acl/PKGBUILD > and if /var/abs/core/acl/PKGBUILD changes place an entry into a file as in > /var/abs/core/acl/PKGBUILD updated or something similar. > > I tried diff but it did not work out as there was too much data I am > looking for just a simple list. I assume that by "changed" you mean "having different hash" or something like that. Try this: #!/bin/bash export H=/home/rose/garden export V=/var find "$V/abs/core" -type f -name PKGBUILD -exec bash -c ' m1=$(md5sum "$1"|cut -d " " -f1) m2=$(md5sum "${1/#$V/$H}"|cut -d " " -f1) if [ "$m1" != "$m2" ]; then echo "$1 updated" fi' sh '{}' \; |
|
|||
|
pk wrote:
> On Saturday 30 August 2008 14:53, Baho Utot wrote: > >> >> I have two directories: >> >> /home/rose_garden/abs/core and /var/abs/core >> >> they both contain directories like this >> >> acl/ >> +-----PKGBUILD >> atl2/ >> +-----PKGBUILD >> etc >> >> /var/abs/core is rsynced from ArchLinux repos. >> and /home/rose_garden/abs/core is my work area. >> >> When Arch changes or updates the PKGBUILD file I would like to get a list >> of changed files so I can rebuild my files based in >> /home/rose_garden/abs/core Simply rsync between the two directories won't >> work as I need to make some changes before using the "new/updated" >> PKGBUILD file. >> >> I would also like to include any new files that don't reside >> in /home/rose_garden/abs/core but are in /var/abs/core as they represent >> new software packages placed into the repos. >> >> I would like the list to contain only the files that where updated or >> changed. >> >> Comparing >> /var/abs/core/acl/PKGBUILD to /home/rose_garden/abs/core/acl/PKGBUILD >> and if /var/abs/core/acl/PKGBUILD changes place an entry into a file as >> in /var/abs/core/acl/PKGBUILD updated or something similar. >> >> I tried diff but it did not work out as there was too much data I am >> looking for just a simple list. > > I assume that by "changed" you mean "having different hash" or something > like that. Try this: > > #!/bin/bash > > export H=/home/rose/garden > export V=/var > > find "$V/abs/core" -type f -name PKGBUILD -exec bash -c ' > m1=$(md5sum "$1"|cut -d " " -f1) > m2=$(md5sum "${1/#$V/$H}"|cut -d " " -f1) > if [ "$m1" != "$m2" ]; then > echo "$1 updated" > fi' sh '{}' \; Thanks I will try this |