Hi,
I have a directory which contains in it multiple files (backups of virtual machines). They are named (for example):
webserver-19012011.xva
webserver-12012011.xva
webserver-05012011.xva
dbserver-19012011.xva
dbserver-12012011.xva
dbserver-05012011.xva
What I need to do is commit a diff (the files are in excess of 8GB) of the two latest files in each set (webserver diff and db server diff) and if they are identical delete one of them (not bothered which). The modification dates match the last characters, so ls -t is an option.
I've been working on this logic, however given my example it would only check the two webserver VM's:
Code:
diff --brief `ls -t /VM_container/ | tail -2`
I'm struggling with how to pair them up for the diff more than anything else :S. I think I can probably handle the rm bit, however it maybe easier to have a diff of two variables and then delete one of them.
Thanks, sorry if this is too verbose!