Results 1 to 3 of 3

Thread: How to compress directory through code

  1. #1
    Join Date
    May 2010

    How to compress directory through code

    I am working on a kind of backup/restore system that will facilitate the user
    to back up the home folder.
    The problem is I dont know, how to do it in C language.
    I have downloaded the source codes of TAR and Gzip, but they have
    a huge source code.

    So please help me in either one of the following:
    - How to compress folders using coding in c/c++
    - How to use the TAR or Gzip (or any other zip software that works for Ubuntu), in my code

    I am using GTK+ with C language


  2. #2
    Join Date
    Oct 2007
    Pasadena, MD, USA

    Re: How to compress directory through code

    Assuming you have the relevant experience with GTK and an applications programming language (C, C++, Python, Vala, etc) you could try libarchive for a wide variety of compression techniques:

    You can also do the more "GNOMEy" thing and use GIO / Gvfs archive backend to do your file operations. Bindings for GIO are much more widely supported in non-C languages than libarchive, from what I can tell. Check out the API at for details (or use Devhelp, a program available on Ubuntu, for a more native format).

    This is the wrong forum to ask this question, though. This forum is for developers to share experimental work with the community and to solicit feedback before pushing it up the distribution chain.

  3. #3
    Join Date
    May 2010

    Re: How to compress directory through code

    Thanks, I will try on the information you provided


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts