I want to add/update just the files of the current directory into archive.7z without recursing into lower directories. This works, but it's slow due to initialization for each file:
find -maxdepth 1 -type f | while read f;do 7za a ~/archive.7z "$f" ; done
This also works, and is much faster, but unsure how bulletproof it is for problematic file names with spaces and other problematic chars:
find -maxdepth 1 -type f -print0 | xargs -r0 7za a ~/archive.7z --
Shouldn't there be a more elegant way? Like with -T - in the tar command. I'm currently using 7za version 9.20 on Ubuntu16. Variants such as these below failed, they started recursing into lower directories which I don't want:
7za a -r- ~/archive.7z .
7za a -r- ~/archive.7z ./
7za a -r- ~/archive.7z *
7za a -r- ~/archive.7z -- *.*
7za a -r- ~/archive.7z -- "*"
7za a -r0 ~/archive.7z -- *.*