It seems like that would be the only visualy pleasing method of doing this.
Through test I have found that a bare bone file count takes between 5 and 10 seconds ( on my 22GB of used space, bloated to the depths of hell with nothing but windows Vis-I'm gonna make you spend money-ta log files, C drive ).
I could also implement the Used space count, which as you stated is a lot higher than what is accessable. This way the progress would have a meaningful start and when the second thread has finished, the actual file count could be used as a completion. I will have to test this but I really doubt there would be any noticable effects, especially on vlumes with a high file count.
I could also implement the Used space count, which as you stated is a lot higher than what is accessable.
I did a test on my machine and found that I could only account for 25.3GB of the 28.2GB that is used. That's 2.8GB that something is consuming. The net result was the progress indicator finished at 90%.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
When you first format a NTFS volume, some 12% of that is pre-allocted for the MFT ( which FindFile's can't find ). Try running your test again but manualy open "C:\$MFT" and "C:\$MFTMirr" and account for the sizes
The other NTFS specific file are small enough to forget about.
I thought of that, but I've got files that are a few bytes in length, and they are found by CFileFind.
CfileFind will return the size regardless of which part of the disk it is stored. A more realistic method would be to pass each file into DeviceIoControl and count the cluster/fragment usage. 0 fragments indicates that it is stored in the MFT.
Also, I have just accounted for a further 4GB by giving myself access rights to the "System Volume Information". If you know of a way to do this programaticaly I would be glad to hear.
My next step is to call CreateFile for every file/folder found, if it fails then I should attempt to adjust the access rights. This is where CFindFile fails the most, it gives no indication of where it skipped a file/directory simply because it had no rights.
you would need to use the FSCTL_GET_EXTENT_BUFFERS. The trouble is with this operation is that you don't know how large the buffer should be. I wrapped the call up in a class with the buffer as a static member. Each time the buffer is too small, I double the size and keep calling until successful.
The Extent count indicates how many fragments the file has, 0 indicates that it is located in the MFT. Each extent returned will then tell you how many clusters each fragment has. By adding these and multiplying by your drives 'bytes per cluster' you will find out exactly how much space a particular file/folder is taking.
Also be aware of NT's compressed runs which is indicated by a startLCN of -1. I still haven't managed to get my head around what this actualy means.
To be honest, I didn't touch that part of my code yet, I'm still working on my class hierarchy.
I was thinking to use ShellExec() with the "runas" flag, change the security settings and store them into a file, which I believe cacls is able to do. This should, in theory, allow the origional settings to be replaced once complete. But like I said, I didn't try this yet and probably won't for another week or so.
If you manage to do it using another method, I would be interested to see how.
i have establish a connection to remote computer by FTP and how to search file on remote computer in a particular directory and as soon as i found file i want to bring that file in my computer and search again for next file
plaese help me
thank u in advance
Hello to all,
right now i am doing a programm such that files selected by user will be uploaded on the server, now while uploading the files i want to invoke a progress bar dialog which will show the number of files uploaded and time left for uploading, through progress bar and this should be done without disturbing the process of uploading files. how it can be done? can anybody help me plz.
I would suggest the opposite: do the real work in a separate thread (in this case, the upload of the files) and regularly send messages with the current status to the progress dialog (which is in the main thread).