1
I'm writing a bash script that packages my application into a TAR file. The files aren't arranged on disk how they need to be arranged in the TAR file, so I decided to use the --transform option.
However, it seems that the --transform command is applied globally instead of being applied to the files that are included after.
Example:
tar \
--exclude='webmanager/bin/dev' \
--exclude='webmanager/.config.ini' \
--show-transformed-names \
--create --gzip --verbose \
--file 'output.tgz' \
-C '../../../' \
'include' \
'resources' \
'webmanager' \
'rootconfig.php' \
-C 'webmanager/bin/dev' \
'index.php' \
'README.md' \
--transform='s|^|webmanager/|r' \
'.config.ini'
Basically, this code takes a file from webmanager/bin/dev/.config.ini
and places it at webmanager/.config.ini
in the TAR file. But I only want the .config.ini file to be transformed. Currently all the contents are being transformed and prefixed with webmanager/
. I was hoping this command behaved like -C
(change current directory) - where it only affects the inputs after it.
I have looked over the TAR man pages and I can't figure out how to do this properly. Please help!
Feel free to write a patch. – Ipor Sircer – 2016-12-07T03:34:42.430