fdupoux / fsarchiver

file system archiver for linux
http://www.fsarchiver.org
GNU General Public License v2.0
263 stars 42 forks source link

Added 'extract' to access individual files in am archive. #77

Closed phuel closed 8 months ago

phuel commented 5 years ago

Hi,

I'm not the first to do so, but I added an 'extract' command to fsachiver. The command can be used to extract individual files or directories from an archive file without restoring the whole archive.

Most of the functionality was added to oper_restore.c because it was the easiest way to avoid code duplication. The 'extract' command needs a target directory and one or more patters to select the files to extract. The target directory can be specified like the destdir for directory archives and with the 'dest=' option for filesystem archives. When no target directory is specified 'extract' writes the object types, names, sizes (for regular files) and targets (for links) to stdout (kind of an 'ls' for fsarchiver). The files to be extracted can be selected with the '-i' (or '--include') option similar to the existing exclude option. The include option is also active when the filesystem or directory is restored. The default when no include option is given is to include all files. I tried to update the documentation and examples with explanations of the new functionality.

I would be glad if the extension is useful.

Cheers Peter

HGpunktT commented 2 months ago

Dear M. Dupoux

Is there a reason, why this issue was closed without merging the commit from phuel into fdupoux:master?

With this commit I created packages for three different Linux distributions (Alpine, Fedora and SliTaz) and all worked properly.

As this functionality is the one that I and others missed most, I would like to have it in the master branch.

phuel commented 1 month ago

Hi,

the extraction of single files from fsarchiver files is a bit of a hack. The fsarchiver creates an image of one or more file systems that can contain all sorts of file types, like device files, hard links and the like. My patch only handles the extraction of regular files. Other file types are not correctly handled and so the extraction of all files from an archive using the extract option with something like '/*' as filter will likely cause weird things and not the expected results. So i can understand that fdupoux is reluctant to merge the change into the official sources.