Page 1 of 1

display the folder counter during the synch read operation

Posted: 2015-09-05, 11:18 UTC
by Michael REMY
hi,

i have a big partition with lot of folder.

when i do synch operation, the first operation of TC is to read the folder.
During this operation, there is information in the status bar which indicates that he's current reading X folders.

and this operation takes a lot of time.

So to improve the wait, you souhld display :

reading XXX / total folders counts and not Reading XXXX folders...

it is obvious and very userful to know that !

best regards

Posted: 2015-09-05, 12:29 UTC
by Dalai
Good idea, but how is TC supposed to know the total number of directories when it has just begun to iterate through them?

Regards
Dalai

Posted: 2015-09-05, 13:22 UTC
by Michael REMY
Dalai wrote:Good idea, but how is TC supposed to know the total number of directories when it has just begun to iterate through them?

Regards
Dalai
well easy task! windows know it, it is in the property of each folder or root or disk (like left click mouse property on a folder). Even the WMI object instructions can provide such information.

Even this counter is not continue to increase stupidely because once it finished the source disk (when it finished to cataloged it in memory), then it goes on with the destination drive to catalog it to. During this second pass, the counter even not restart to 0, it should go back to ZERO after the source folders read pass ..

Posted: 2015-09-05, 15:53 UTC
by Dalai
Michael REMY wrote:well easy task! windows know it, it is in the property of each folder or root or disk (like left click mouse property on a folder).
And Windows knows that how? Right, by iterating through the whole directory structure, which is exactly what TC does. So we're back to square one.
Even the WMI object instructions can provide such information.
Can you provide more specific information about that? Which class and which property provide that information?
[...] it should go back to ZERO after the source folders read pass ..
Not really. Or rather: not unless some information about the drive (source/destination) is displayed so that the user knows if either source or target is currently being examined. If the counter resetted without such info, there's no way to know if TC is reading the source or destination structure. I guess, that's why TC currently behaves like this.

Regards
Dalai

Posted: 2015-09-05, 21:44 UTC
by Michael REMY
the information about WMI object under windows class

http://blogs.technet.com/b/heyscriptingguy/archive/2004/11/18/can-i-use-a-script-to-determine-the-size-of-a-folder-on-a-remote-computer.aspx

i got a external usb disk of more 20000 folders and the same on my local computer.

each time i have to do a synch is a boring thing because i did not know (before the synch task to do), how many time will the analyse long (folder read before the bilan).
in the first 15min, i hear my internal hardrive running (and see the light red) then after 20000, i can hear my external hard disk is been analyszing too...

let me ask you a question : as tc is now 64bits, why don't you create 2 processes/threads to read-analyse the 2 sources in the same time ?

Posted: 2015-09-05, 22:30 UTC
by MVV
the information about WMI object under windows class
I'm pretty sure it gets information by the same enumeration. Otherwise Windows Explorer could display folder sizes immediately instead of wasting your time (try opening C:\Windows folder properties and check how many time it will need to enumerate all subitems).
let me ask you a question : as tc is now 64bits, why don't you create 2 processes/threads to read-analyse the 2 sources in the same time ?
It is possible with 32-bit too, no problem here. But problem is when source and target physically on the same device - simultaneous access won't speed operation up. I agree that when source and target are on separate devices, two reading threads instead of one may be useful.

Posted: 2015-09-05, 22:45 UTC
by Dalai
I justed tested this and it's the same as with normal functions/programs: the system iterates through the entire directory structure. It's logical that it does, because it's not possible in any other way. Don't know if reading the MFT would do any good here, but that only applies to NTFS, not FAT, FTP, or any plugins TC can sync with.
each time i have to do a synch is a boring thing because i did not know (before the synch task to do), how many time will the analyse long (folder read before the bilan).
in the first 15min, i hear my internal hardrive running (and see the light red) then after 20000, i can hear my external hard disk is been analyszing too...
Yes, I know that feeling. But I let TC read the structure in the background while I'm working on other things, because I know that it takes a while to complete before the actual sync can be started.
let me ask you a question : as tc is now 64bits, why don't you create 2 processes/threads to read-analyse the 2 sources in the same time ?
Hm, doesn't have to do with 64 bit, but that may be worth thinking about. However, I don't know if this can be done; only Ghisler can answer this. And, as MVV pointed out, this has to be used with caution when source and target are on the same physical device since this will massively slow down the entire process (which is the opposite you'd want to achieve).

Regards
Dalai

Posted: 2015-09-05, 23:58 UTC
by milo1012
MVV wrote:But problem is when source and target physically on the same device - simultaneous access won't speed operation up. I agree that when source and target are on separate devices, two reading threads instead of one may be useful.
We already have the (voluntary) option in:
Copy/Delete -> The following drive letters are on the same physical harddisk.
Seems one good point to start.

Also I'm pretty sure that there are ways do find out about partitions/drives programmatically.
It might be hard to do it w/o admin rights and/or on all OSes though.

Posted: 2015-09-06, 11:57 UTC
by MVV
I found the example of detection device number by drive letter. It doesn't require administrator rights.

This detects device numbers for all drive letters:

Code: Select all

#include <WinIoCtl.h>

		for (DWORD mask = GetLogicalDrives(), drive_letter = 'a'; mask; mask >>= 1, ++drive_letter) {
			if (!(mask & 1)) continue;

			wchar_t volume_path[16];
			wsprintf(volume_path, L"\\\\.\\%c:", drive_letter & ~0x20);
			int drive_type = -1, drive_number = -1;

			HANDLE hvol = CreateFile(volume_path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
			if (hvol != INVALID_HANDLE_VALUE) {
				STORAGE_DEVICE_NUMBER sdn;
				DWORD bytes = 0;
				if (DeviceIoControl(hvol, IOCTL_STORAGE_GET_DEVICE_NUMBER, 0, 0, &sdn, sizeof(sdn), &bytes, 0)) {
					drive_type = sdn.DeviceType;
					drive_number = sdn.DeviceNumber;
				}
				CloseHandle(hvol);
			}

			printf("%S: type: %d, no: %d\n", volume_path, drive_type, drive_number);
		}
It returns 0 for my first HDD device (C:, D:, E:, F:), 1 for my second HDD device (R:) and 2 for attached USB device (mobile phone SD-card), also it enumerates CD-ROM devices:
\\.\A:: type: -1, no: -1
\\.\C:: type: 7, no: 0
\\.\D:: type: 7, no: 0
\\.\E:: type: 7, no: 0
\\.\F:: type: 7, no: 0
\\.\G:: type: 2, no: 0
\\.\J:: type: 7, no: 2
\\.\M:: type: 2, no: 1
\\.\N:: type: 2, no: 2
\\.\O:: type: 2, no: 3
\\.\P:: type: 2, no: 4
\\.\R:: type: 7, no: 1