Stas Sergeev <s...@list.ru> ha escrit: > $ tar cf a.tar a.txt > $ tar rf a.tar --add-file=`pwd`/b.txt --transform=s,`pwd`/,aaa/, > tar: Removing leading `/' from member names
Dominique has explained why that happens. Let me explain the rest. > tar complains to leading slash. In fact, it doesn't. I merely warns you that it is removing the leading slash from pathnames being stored. You don't want it to do so. So what you need is the -P (--absolute-names) option: tar -Prf a.tar --add-file=`pwd`/b.txt --transform=s,`pwd`/,aaa/, For details, please see section 6.10.2 "Absolute File Names" of GNU tar manual. > Why wouldn't tar do its sanity checks and > leading slash removal after the transform, Because it provides a simpler way to do what you need. Regards, Sergey