Thread: Backup program

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    2

    Backup program

    Hi all,

    I need help with my homework. I have to do backup program, which will backup files and directories to one file. The programm will have to make complete or incremental backup or restore one file or directory.

    Im not asking you to do this instead of me, I only need help, because I dont know (the best) way how to save informations about files and directories to only one big file.



    I will be thankful for every advice.
    Thanks

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    How to work with directories depends on your operating system. Also the knowledge required is more than a beginning programmer would be expected to have. So since we know nothing about your knowledge or the actual assignment it would be difficult to help you in any way. So you need to ask more specific questions and provide more information about the actual assignment.

    Jim

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    2
    Operating system is Solaris OS. Im not beginner, classes, templates, structs and so on is not a problem for me.

    The complete assignment is:

    - backup program
    - only one backup file

    - functions:
    - directory or file backup
    - incremental backup
    - restore only one file or directory from backup file
    - identify that the file has changed
    Thats the full assignment, nothing more. My main question is, which is the best way to save informations about files. The main problem for me, is that I have to save everything to only one file and identify where the informations end and where the files start.
    Last edited by nejvetsiborec; 05-04-2011 at 05:07 AM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    For ideas on a file format, try tar (file format) - Wikipedia, the free encyclopedia
    Use stat(2): file status - Linux man page to get information about files.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Look's like there's a library for working with tarchives too:

    libtar - tar file manipulation API

    Of course, this might be going "higher level" than your prof wants. In that case, just come up with your own file format, and schematize a header for it that includes offsets to data and maybe a table of mtimes. That's what an entire filesystem essentially is -- it has a sort of header starting at a fixed point that contains the information necessary for working with the files within it. ".iso" images are an example of files that contain filesystems.
    Last edited by MK27; 05-04-2011 at 06:29 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Backup Systems
    By DavidP in forum Tech Board
    Replies: 7
    Last Post: 12-21-2009, 02:28 PM
  2. We don't need to backup...
    By Salem in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 10-19-2007, 01:12 PM
  3. Backup software
    By Waldo2k2 in forum Tech Board
    Replies: 4
    Last Post: 11-21-2003, 12:49 PM
  4. Burning a backup, better way?
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 01-03-2003, 04:52 PM
  5. Backup function
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 01-02-2002, 07:23 AM