Uma abordagem do Git
Dependendo das necessidades, pode ser bom usar o git também. Poderia ser facilmente estendido para incluir outros arquivos, etc. O script abaixo é uma variante simples de
um mais complexo que eu escrevi para esse propósito. Funcionalidade de localização adicionada.
Ele lê as datas do arquivo extraído e usa isso no commit - assim você também
tenha uma boa visão do tempo.
Uso de amostra
Como exemplo, você poderia diferenciar nas versões:

OuuseaGUIparamostrarasdiferenças.AoconservardatasemcometeroAvisãotambémforneceumaboavisãogeral:
Posicionada no diretório git, você também pode facilmente ver vários
versões, por exemplo,
gvim abc.xsd
git checkout 10.1.2.2.0
# Look at this version
# Go back
git checkout master
# View pretty log
git log --date-order --graph --tags --simplify-by-decoration --pretty=format:'%ai %h %d'
E assim por diante e assim por diante.
Caminhada rápida
- Crie um diretório de destino e inicialize o Git. (Remova primeiro se existir).
- Listar pastas no diretório de origem e classificá-las por classificação de versão. (Modifique o script, verificando qual tipo dá melhor resultado).
- Percorra cada diretório por ordem e localize o arquivo de origem.
- Copie o arquivo para o diretório de destino e extraia o arquivo necessário.
- Leia a data de modificação do arquivo add e commit.
Script
#!/bin/bash
#
# Please read script thoroughly before use.
#
# Git directory (created, old deleted!)
git_dir="git_proj"
# Project directory
proj_root="$HOME/tmp/jardiff/sample_proj"
release_dir="GENERIC/RELEASE"
# If file always is in same location:
target_dir="$release_dir/x/y/z"
# Files to (find) copy and extract
jar_file="abc.jar"
xsd_file="abc.xsd"
# If we should use relative absolute target directory or find
use_find=1
# If we want to commit empty (no change, but to list version as separate commit)
commit_empty=0
# Remove existing and create project diff directory
[ -e "$git_dir" ] && (echo y | rm -r "$git_dir")
mkdir -p "$git_dir"
cd "$git_dir"
# Init empty git
git init
# Date is read from file
export GIT_COMMITTER_DATE
export GIT_AUTHOR_DATE
# Author unknown (or extract it from elsewhere)
export GIT_AUTHOR_NAME="Unknown"
export GIT_AUTHOR_EMAIL="[email protected]"
# Committer
export GIT_COMMITTER_NAME="Auto Batch"
export GIT_COMMITTER_EMAIL="[email protected]"
for dir in $(ls -d "$proj_root"/* | sort -V); do
echo "Processing: $dir"
# Use root directory as project version
bn=$(basename "$dir")
# Copy target to git directory
if ((use_find)); then
if ! fn=$(find "$dir/$release_dir" -name "$jar_file" -print0); then
fn="" # Probably not needed
fi
else
fn="$dir/$target_dir/$jar_file"
fi
if [ -e "$fn" ]; then
printf "Copying in %s\n" "$fn"
cp --preserve=timestamps "$fn" .
# Extract
jar xf "$jar_file" "$xsd_file"
# Read modified timestamp
ts=$(stat -c %y "$xsd_file")
# Set Git env date variables
GIT_COMMITTER_DATE="$ts"
GIT_AUTHOR_DATE="$ts"
# Add file and commit
git add "$xsd_file"
else
# Use timestamp from root directory
# Here you would probably use a README file
# or something else that has a more likely correct date
# either by a new find or relative path.
ts=$(stat -c %y "$dir")
printf "Tagging empty %s - %s\n" "$bn" "$ts"
# Set Git env date variables
GIT_COMMITTER_DATE="$ts"
GIT_AUTHOR_DATE="$ts"
fi
if ((commit_empty)); then
git commit --allow-empty -am "Release $bn"
else
git commit -am "Release $bn"
fi
# Tag as release
git tag -a "$bn" -m "Release $bn"
done