I have two identical directories, one mirroring the other through
vs
As you can see, the ordering is completely different.
It seems to work in place, but if I
Do you have any recommendations on what I could try? Is there an existing utility (in base or a script that can run from base) that does this in a better way?
rsync -a
. I'm trying to create a checksum of all of the files with tar
. The file ordering varies between them and breaks this.
Code:
bash# pwd; tar cf - . | tar tf - | head -n 5
/mnt/files/terancorp
./
./backup/
./code/
./ebooks/
./freebsd/
vs
Code:
bash# pwd; tar cf - . | tar tf - | head -n 5
/srv/files/terancorp
./
./ansible/
./websites/
./.tarsha256sum
./misc_source/
As you can see, the ordering is completely different.
gtar
has a sort option, but I would prefer to make this FreeBSD native as this script needs to run before I have any ports installed. The whole purpose is to verify integrity of the directory. Attached is the script to give an idea of what's I'm trying to do.It seems to work in place, but if I
cp -a
or rsync -a
the directory elsewhere, it breaks due to ordering. If tar could sort the order in which files are archived, I think it would work portably.Do you have any recommendations on what I could try? Is there an existing utility (in base or a script that can run from base) that does this in a better way?