This lists all files in two backups, sorted by size:
tar tvf backup1.tar.bz2 |sort -k3 -n >backup1_files.txt
tar tvf backup2.tar.bz2 |sort -k3 -n >backup2_files.txt
I'd like to list all files present in backup2.tar.bz2 but not present in backup1.tar.bz2, sorted by size.
How to do this?
NB:
Doing a
diff
of these .txt files won't work because the modification dates of some files won't be the same. Thus this question is not a duplicate of Is there a tool to get the lines in one file that are not in another?.Removing
v
would remove the modification dates, but also the filesizes, so it's not an option because it would be impossible to sort them by size.
v
option. You don't need that here, justt
should get you the filenames – muru Nov 01 '19 at 07:12v
, I don't have the filesize, and then I cannot sort by size ; for this reason it seems not to be a duplicate here. – Basj Nov 01 '19 at 07:33tv
to get the size, so I don't see any problem. – muru Nov 01 '19 at 07:39tar
anymore, so how could I passtv
? It might be easy for you but it's not obvious for me ;) maybe could you post an answer? Thank you in advance. – Basj Nov 01 '19 at 07:48xargs < list-of-files tar tvf some-file.tar.bz2
– muru Nov 01 '19 at 07:56