On 01Feb2023 20:24, Patrick Dupre pdupre@gmx.com wrote:
To create a tar file, I used to create a list and to make tar -cvzf arch.tgz $list
However, if there are file names with a space, this space is interpreted as file name separator.
If you can match the files with a glob (shell pattern):
tar cvzf arch.tgz *.ext
Obviously replacing *.ext appropriately. And of course you can give that many times.
If the files are the entire content of a directory, merely mentioning the directory is enough:
tar cvzf arch.tgz directoryname
Of course you can give multiple directories or globs.
And in modern shells there's a "**" pattern means a recursive walk. So:
tar cvzf arch.tgz subdir/**/*.py
to name all the .py files in subdir. And so forth.
All of these are space (and other weird characters) safe.
If you must make the tar file in a few goes/batches, do the first with "c" (create) and the rest with "r" (replace), which does an append.
Cheers, Cameron Simpson cs@cskk.id.au