linux - Tar Multiple Files and Folders, and Specify Archive Structure -
linux - Tar Multiple Files and Folders, and Specify Archive Structure -
i'm working on programme update mechanism uses php script find latest versions of set of files, , create tar archive of these files.
so, list of files beingness archived like:
/updates/0.5.1/fileone /updates/0.5.1/filetwo /updates/0.5.2/folderone/filethree /updates/0.5.3/folderone/filefour what i'm trying files in list tar archive, caveat beingness directory construction after version folder (e.g. 0.5.1/...) must maintained. so, if of files beingness set in archive, archive construction should be:
/fileone /filetwo /folderone/filethree /folderone/filefour i've tried using tar cvf ... total paths, resulting archive construction mirrors set in (/updates/...).
any suggestions on how this? thanks!
split pathname version prefix , rest. do:
tar rv -c "$prefix" -f "$tarfile" "$rest" the -c $prefix alternative performs cd $prefix before archiving $rest, pathname relative directory.
use r alternative instead of c, appends existing archive rather creating new archive scratch. allow loop through filenames, each of prefixes, , add together them archive.
linux tar
Comments
Post a Comment