Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

ubuntu 14.04: How to compress a directory which have symlinks?

Writer Matthew Harrington

I have a php project of size 3.5GB in which there are symlinks of several files. I want to zip it and take backup to windows 10 PC from my ubuntu 14.04 laptop. Whenever, I make a zip file of it and take backup in PC and when i copy the backup zip file of my project back from windows PC to laptop and unzip it then the symlinks are not there instead the symlinks are shown as normal php files.Image with symlinks

Image without symlinks

first image is with symlinks and seconds is without symlinks. What is the proper way to zip a large folder so that I will not loose any symlinks?

7

1 Answer

Actually, a simple search reveals an anwer. The standard zip utility that comes with Ubuntu (Info-ZIP) comes with an option that allows to store symlinks as symlinks. By default, symlinks are dereferenced, i.e., the actual file linked to is included in the zip, as you experienced. The command might look like:zip --symlinks -r foo.zip foo/(credit goes to the Server Fault site)

You may consider using compressed tar archive formats instead for this task. The tar archive format by design supports linux file system features including symbolic links, file permissions, whereas zip originally has its origins rather in the MS Windows environment.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy