creating zipfile with symlinks

crankypuss invalid at invalid.invalid
Fri Mar 4 06:03:00 EST 2016


Larry Martell wrote:

> I have a script that creates zip files of dirs containing symlinks. I
> was surprised to find that the zipfiles have zipped the targets of the
> links as opposed to the links themselves, which is what I wanted and
> expected. Googling I found this:
> 
> https://doeidoei.wordpress.com/2010/11/23/compressing-files-with-python-symlink-trouble/
> 
> Which I don't love as a solution. Anyone know a cleaner way to get
> zipfile to zip the links?

I don't even know what "zipfile" is, is that a Windows command?  On 
linux the tar command's --dereference option causes the behavior you 
describe, which is not its default.  Not sure if this is applicable to 
your situation, or not:

http://www.gnu.org/software/tar/manual/html_node/dereference.html

-- 
http://totally-portable-software.blogspot.com
  [Mon Feb 29: "Addresses - What Good Are They?"]




More information about the Python-list mailing list