Results 1 to 2 of 2

Thread: Backup Program Coding Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2014
    Posts
    20

    Backup Program Coding Help

    I my project I have a little backup thing where the user selects a folder to backup and a location to back it up to. I have two textbox's, 3 buttons and a progress bar. The first button (button1) is to select a folder which will then be shown in the first textbox (textbox1). The second button (button2) is to select a save location and it will be shown in the second text box (textbox2). The third button is the backup button which will copy and compress the folder from textbox1 to the location in textbox2 but this will be inside another folder which name is the date and time of the backup. The progress bar will show the progress of the copying and compressing.

    If possible I would also like to add a status thing that shows how many folders and files there are and how many have been copied and compressed.

    I have no idea how to do this so any help would be greatly appreciated.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Backup Program Coding Help

    Displaying an accurate progress is not completely practical because you will first have to traverse the entire folder tree in order to find all the files and folders to be copied. You can't know how long that will take so an accurate indication of progress is impossible. What you might do is set the Style of the ProgessBar to Marquee while you get the list of files and folders. Once that's done you will be able to count the files to be copied so an accurate progress of the actual copy will be possible.

    To get a list of all files and folders you can use the Directory.GetDirectories and .GetFiles methods in a recursive method. There are lots of examples around of recursive file searches so a bit of web searching should yield all the information you need.

Tags for this Thread

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