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, and are not satisfied with the copy function built into 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 since Windows NT 4.0. Part of the toolkit, then built into Windows Vista, Windows 7, and Windows Server 2008 as standard features, this tool not only copies very fast, but also supports breakpoint retransmissions, and even supports copying at a defined 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, if you want 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 if you suddenly remove the CD at this time, it does not matter, Robocopy will wait until the disc is reinserted into the drive and the copy will start automatically. 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 inconvenience to others. Let's take a 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 subdirectory is included, /MT:50 is 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


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 and ending at 14:57:06, sharing 35 seconds to get time. It is recommended that in order to be able to test how many threads can be selected to copy files more quickly, use PowerShell scripts for batch processing to test the corresponding relationship between time and thread in the case of different threads, and plot them on coordinates. The tested PowerShell script 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 format of the script output is formatted, imported into Excel via CSV format, and the line chart is as shown in the following figure. & nbsp; Series 1 & rdquo; Line:

There are 324 files in the target directory of the copy, the single file size is between 1MB and 2MB, the total file size is 549MB, compared with the single file with the size of 878.16MB above. When copying It is longer than before. Because of the large number of files, it takes a long time to copy one by one, and there will be errors after many experiments. After normalization, the yellow color in the figure is linear (Series 1). ), as shown by the line, you can see 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, robocopy has many powerful methods of use. Readers 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 which the reader will find more powerful options for this command.

Previous 12 Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved