Results 1 to 8 of 8

Thread: Backup app help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    329

    Backup app help

    Hi. I am making a backup app and just came across a test situation.
    I am zipping files & folders to a zip file and then will add the date to the end so i can have multiple backups.

    I can add folders & files from different paths to the zip, but the issue is:

    If i zip up a folder ie C:\Test\*.* & i also add a single file to the same zip as well ie C:\Test\Test.txt this will add 2 x Test.txt files to the zip.

    would it be best to check the conflict as i am adding folder and files to create the backup job and alert the user.

    or is there something else i should do.

    tks

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    329

    Re: Backup app help

    Anyone?

  3. #3
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,431

    Re: Backup app help

    Quote Originally Posted by k_zeon View Post
    I am zipping files & folders to a zip file
    The problem is there, nobody knows how you are zipping the files.
    If you are using a program, usually it will ask for overwrite or will overwrite the file without asking when the same file already exists.
    So nobody knows what to answer because nobody knows what you are doing and why you have that problem.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    329

    Re: Backup app help

    ok, so i am making my own backup app and wanted to know some strategies.
    I current have the app working that can zip up folders & files using cZipArchive (c) 2017-2019 by wqweto@gmail.com (fantastic class to zip)
    But i found a small issue that if i add a folder
    ie C:\Test to a zip file using code and then also add a file ie C:\Test\test.txt these would be 2 files would be in the zip with that same file name.
    see image Attachment 185477 when i open the zip file i created

    Now if i try to extract this file later, it asks me the question (see image)

    so now i am thinking, should i allow this single file to be added to the zip file if i already have a folder backing it up any way.

    eventually i settle that i would check files and folders when creating a new job that if a File or Folder is being added, it checks to see
    if i should add this file or folder.

    I just wanted some guidance on programatically adding files & folders to a zip if they are in the same path. if there are any more caveats to look out for.

    tks
    If i have not explained well then i am sorry.

  5. #5
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,431

    Re: Backup app help

    If the same file is added twice, I would compare the date of the new with the one already in the zip, if it is newer I would replace the file, but if the date is the same or before, I would not add it (skip it).

  6. #6
    Frenzied Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    1,596

    Re: Backup app help

    Once a backup is created you should never add to it, that causes ambiguity and uncertainty. The empty zipfile is opened like a jug and you pour your contents in. Any files must have their own specific folders preserved and so there will be no naming conflicts. Once the backup is taken, the archive or zip is closed and never written to again.

    No file should ever be written more than once to a backup so a naming conflict can never happen...
    By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    329

    Re: Backup app help

    Quote Originally Posted by yereverluvinuncleber View Post
    Once a backup is created you should never add to it, that causes ambiguity and uncertainty. The empty zipfile is opened like a jug and you pour your contents in. Any files must have their own specific folders preserved and so there will be no naming conflicts. Once the backup is taken, the archive or zip is closed and never written to again.

    No file should ever be written more than once to a backup so a naming conflict can never happen...
    tks for the reply.

    As you said , once i have done a backup ie all files & folders that i select. no more will be written to the zip file

    What i wanted to know was on the selection part to create the inital job.

    ie Job Name , Backup path , No of backups to make, then i wanted to Add Folders & files.

    However , i did not want to add Folders and files that might duplicate

    ie C:\Test\*.* folder and then let the end user also select C:\Test\testa.txt , as you will see the *.* folder will already have this

    I made a helper function do a check for any folder or files being added to check for conflicts and seems to work ok.

    thks

  8. #8
    Frenzied Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    1,596

    Re: Backup app help

    Each user selection should be inserted into its own distinct backup archive. One zip per backup selection.

    Typically, a user will backup a drive or a data folder and dump that to an archive with an appropriate name. They will not mix and match.

    Merging backup selections into a single archive is where logic mistakes will occur, so just don't make those mistakes by keeping each operation's output distinct and separate.
    By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

Posting Permissions

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



Click Here to Expand Forum to Full Width