I'm trying to create a .tar file in Cygwin:
find . > tmpfilelist
tar -cf tmp.tar -T tmpfilelist
but when I open tmp.tar in Windows with 7-Zip there are four instances of each file:
Name Size Link
.gitignore 62
.gitignore 0 path/to/.gitignore
.gitignore 0 path/to/.gitignore
.gitignore 0 path/to/.gitignore
and when I extract the tar to its own folder I am prompted to overwrite each file three times. Additionally, viewing the extracted folder's properties in Explorer shows a size of 0 bytes.
Is it possible to create a .tar file in Cygwin that will behave in Windows? Just to clarify, I'm only using the .gitignore files as an example; the issue seems to be with all files.
Edit:
$ tar -tvf tmp.tar | grep -i "link to" | grep -i ".gitignore" | sort | head -n20
hrw-r--r-- user/None 0 2011-07-06 11:27 path/to/.gitignore link to path/to/.gitignore
hrw-r--r-- user/None 0 2011-07-06 11:27 path/to/.gitignore link to path/to/.gitignore
hrw-r--r-- user/None 0 2011-07-06 11:27 path/to/.gitignore link to path/to/.gitignore
hrw-r--r-- user/None 0 2011-09-29 15:40 path/to/other/.gitignore link to path/to/other/.gitignore
hrw-r--r-- user/None 0 2011-09-29 15:40 path/to/other/.gitignore link to path/to/other/.gitignore
hrw-r--r-- user/None 0 2011-09-29 15:40 path/to/other/.gitignore link to path/to/other/.gitignore
...
.
$ grep -i ".gitignore" tmpfilelist | sort | head -n20
path/to/.gitignore
path/to/other/.gitignore
...
Cygwin's tar
is showing the same listing, but the tmpfilelist does not appear to have these extra links. So I guess the real question is how to make a nicely formed tar file in Cygwin? I'm not sure if they're relevant or how to apply tar
's --dereference
and --hard-dereference
options.
Edit: As far as I know, 7z
doesn't preserve directory structures when given a list of files without specifying a root and there is no common root for some of the files in my list (the list will eventually be aggregate for multiple find
executions).
tar.bz
, I'm only usingtar -cf
.tar -tvf tmp.tar
? Also, what is listed if you print out file tmpfilelist?