Windows 7 system uses multi-threading to speed up file copying?

  
Why can't I speed up the file copy/transfer function in Windows 7 under Windows 7? Multithreaded file copy implementation can be implemented with robocopy.
Friends who often perform file management operations, mention copy/paste operations, presumably many people will recall the slow copy speed of Vista, not satisfied with the built-in copy function of Windows system, because it is too fast . So everyone used FastCopy, TeraCopy and other software to speed up the copy, Windows 7 then fixed the problem, but the effect seems not ideal, but do you know that Windows 7 has built-in fast copy function? Solution:
It is recommended that if you want to copy a directory containing multiple large files, you need to use the RoboCopy command, which is a command line directory copy command that has been a Windows Resource Kit since Windows NT 4.0. Part of it, then built on Windows Vista, Windows 7, and Windows Server 2008 as a standard feature, this tool not only copies very fast, but also supports breakpoint retransmission, and even supports copying at the specified time. This feature has also been upgraded in Windows 7? D?D can already support multi-threading, which means that the replication speed can be greatly improved. And this feature creates a full mirrored copy of two file structures without copying any unwanted duplicate files, while also allowing you to keep all relevant file information, including date and time stamps, security access control lists (ACLs), and more. The copying of N small file directories can increase the speed by an order of magnitude. Thousands of files are copied in 3 seconds, and the usual copy and paste method takes about 45 seconds.
For example, to copy all the files in the CD-ROM to the //CD directory of the E-disk, you can run the following command:
Robocopy /s F://E://CD
Even At this point, suddenly remove the disc, it is no problem, robocopy will wait until the disc is re-inserted into the CD-ROM and will automatically start copying.
Robocopy also supports LAN copying, and even the directory structure of the specified directory in the LAN server can be moved to the local. Robocopy supports the timing operation, and the copy operation can be performed at night to avoid congestion on the LAN and bring it to others. inconvenient.
First look at the usage of this command, as shown below:
For example: RoBoCopy dir_from dir_to /E /MT:50 /LOG:copy.log
where /E means to include subdirectories, /MT: 50 uses 50 threads (default 8 threads, up to 128), /LOG is the redirect output. More options can be viewed with robocopy /?.
Command syntax: ROBOCOPY source destination [file [file]...] [options]
Source: Source directory (drive: path /////server //share //path)
Target: Target directory (drive://path or ////server//share//path)
File: File to be copied (name/wildcard: default is "*.*")
In order to test the speed of copying files, the following test was done.

It can be seen from the above figure that in the case of 120 threads, a single file with a size of 878.16MB is copied, starting at 14:56:31. 14:57:06 ends, sharing 35 seconds of time.
Recommended in order to be able to test how many threads can be selected to copy files more quickly, use PowerShell script for batch processing to test the corresponding relationship between time and thread in the case of different threads, and plot them on the coordinates To plot, the PowerShell script tested is as follows:
for($i=128;$i ?Clt 129;$i++){
Robocopy /s C://CD C://test//CD$i /MT:$i /LOG:log/copy$i.log
remove-item C:////test//CD$i//*.*
"$i ," > >log/answ.txt
(Get-Content C://log//copy$i.log -TotalCount 6)[-1] >>log/answ.txt
"," ; >>log/answ.txt
(Get-Content C://log//copy$i.log -TotalCount 10000)[-1] >>log/answ.txt}
The contents of the script output are formatted, imported into Excel through CSV format, and the line chart is as shown in the following figure: “Series 1”; Line:

There are 324 files in the target directory of the copy. The single file size is between 1MB and 2MB, and the total file size is 549MB. Compared with the single file with the size of 878.16MB above, the copying time is longer than before. Long, because the number of files is large, it takes a long time to copy one by one, and there are errors in many experimental experiments. After normalization, the yellow "Linear (Series 1)" line is shown in the figure. As shown, it can be seen that the same file group has different copy speeds when using different threads. As the number of threads increases, the copy time decreases linearly.
In fact, there are many powerful ways to use robocopy. You can use the robocopy /? command to query, or view the detailed options of the RoboCopy command from the attachment at the end of this article. From this reader, you will find more powerful options for this command. .

Copyright © Windows knowledge All Rights Reserved