Re: afio batch operation
Hi,
> I have a CD that was written by mondorescue and it has hundreds of files in
> the form
> <number>.afio.bz2.
They must be quite small if hundreds of them fit on a CD.
> Can someone suggest a simple command line to extract the hundreds of files
> and write/merge them into a single directory tree?
The name suffix .bz2 could mean that afio used -Z -P bzip2 when packing up
the archives, or that the completed afio archive files were compressed
by bzip2. This matters, because afio -Z compresses individual files in
the archive, whereas a bzip2 run on the archive stream compresses the
whole archive. (This differs from the situation with tar -z)
If the archive files were made with afio -Z, then program "file" should say
about them
<name>: ASCII cpio archive (pre-SVR4 or odc)
An afio achive post-compressed by bzip2 should yield
<name>: bzip2 compressed data, ...
According shell runs for inspection would then be
afio -tv NNN.afio.bz2
or
bunzip2 < NNN.afio.bz2 | afio -tv -
For a combined list of all file paths in the archives i would run
for i in *.afio.bz2
do
# One of:
# afio -tv "$i"
# bunzip2 < "$i" | afio -tv -
done >/tmp/all_afio_paths 2>&1
Then study file /tmp/all_afio_paths to learn about the path situation.
If all paths are relative, i.e. with no leading "/", then create a new
directory at a suitable place on the hard disk. Like:
archive_dir=/mnt/iso
unpack_dir="$HOME"/all_afio_files
mkdir "$unpack_dir"
cd "$unpack_dir"
Then unpack the archive files:
for i in "$archive_dir"/*.afio.bz2
do
# One of:
# afio -ivZ -P bzip2
# bunzip2 < "$i" | afio -iv -
done
If there are absolute paths in the afio archives, then you might need chroot
to force the unpacking to your $unpack_dir.
Consider to practive with a single archive file first.
Try to find one which contains no old copies of important files.
Have a nice day :)
Thomas
Reply to: