I'm creating tar file by running the script. Script is in folder A. I want to append the file into tar. The input file and tar file both are in folder B. When I am appending file to existing tar I have give absolute file path as it is in another folder and when its going to append into tar it should get renamed to the name I want.
- Script location:
- File location I want to add in tar:
- Tar file location:
archive.tar it should get renamed to
I'm trying this command but no success:
tar --transform='flags=r;s|/root/myFolder/B/foo|bar|' -cf archive.tar /root/myFolder/B/foo
It's adding file as it is with same name