@ne555
You don't seem to understand the meaning of homework. |
Too bad this isn't homework then, eh? I'm not even in school yet.
On another note:
To better clear things up-
The algorithm will go down a list of directories that the user sets. For each directory, it will perform the following algorithm:
1 - Iterate the files/folders
2 - Create the folders (directories/subdirectories) under the target folder in an identical 'structure' to the origional.
3 - now we have an identical directories/subdirectories (only folders) under our target directory, so copy all of our files into their corresponing directories/subdirectories under the target directory.
4 - return to the colling function, which will then call this function again with the argument of the next directory (folder/file the user wants backed up).
in steps two and three, we are copying only 1 of many user- defined directories. Because of this, we only know how many files and folders are in that 1 directory. The parent function, being the one that lists the directories and emplements the algorithm on each, can be used to pass a 2nd value: total percent complete, that is how many user-defined directories we have copied, out of the total user-defined directories.
so:
percent value 1 = number of files/folders we have copied from 1 user-defined directory, out of the total number of file and folders in that directory
percent value 2 = number of user defined directories we have completely copied, out of the total number of user-defined directories.
Since the files/folders in 1 given user-defined directory can be iterated at a single time, we can not assume the total number of files/folders contained in the entire backup. This also means that the percentage completion for copying files/folders of 1 of the user-defined directories pertains only to that one user-defined directory: in other words, every time a user-defined directory is finished copying, we assume a new total value of files/folders, and therefore and new percentage. This has the effect of the percentage will start from 0% for each user-defined directory.
If I still haven't made my self clear, please ask.
Examples:
C:\dir1 -> E:\targetfolder\dir1\dir2\dir3 (assume iterated)
C:\dir12\dir22\dir32 -> E:\targetfolder\dir12\dir22\dir32 (assume iterated)
steps:
1 get files and folders for dir1
2 create folder structure adentical to origional
3 copy files iterated to
targetfolder (display percent complete)
4 get files and folders for dir12
5 create folder structure adentical to origional
6 copy files iterated to
targetfolder (display percent complete)