How to create flat tar archive
for GNU tar you can use the --xform
argument. It takes a sed
expression and applies it on each file name. So for removing all characters up to the last /
, you may use:
tar -c --xform s:^.*/:: your-files
outfile=$(pwd)/ps.tar;find . -type f | while read file; do
tar rf $outfile -C $(dirname $file) $(basename $file)
done
gzip $outfile