What does "preparing for copy" do?

24

1

When copying large numbers of files in one sweep, windows requires quite some time to prepare the copy? The same happens when deleting large amounts of files. What is happening here? What preparations are going on there?

Björn Pollex

Posted 2011-03-25T08:57:00.487

Reputation: 1 083

1I can only speculate that it's scanning the files for issues such as being locked by other processes, permissions etc. – ChrisF – 2011-03-25T09:14:41.830

Answers

8

"Preparing to copy" is a special feature that allows to delay the whole process by unreasonable amount of time and gives you more time to appreciate a fancy dialogue box created by Microsoft designers.

While windows is "preparing to copy" it does not

  • Check for possibly locked files (those will only be revealed during actual copying process, for obvious reasons)
  • Make any changes to your file system (also note that actual filesystem is not the factor here, behavior is the same for NTFS / FAT32)

What it does though is creating the full list of files and performing some magic number calculations to make wrong assumptions about estimated copy time.

Art Gertner

Posted 2011-03-25T08:57:00.487

Reputation: 6 417

2And the funny thing is that when copying from a network share this "preparing" takes more time when the actual copy itself! – Calmarius – 2017-11-02T16:07:14.880

7

It builds the list of all files in the current folder and its subfolders and logs the changes that will be made to the files in a journal. That's necessary because of the way that NTFS works.

Some use cases of that list include:

  • updating file system
  • maintaining file consistency in case of a failure
  • knowing the number of files so you can compute how much time is left to complete the operation, what percentage of the operation has been completed so far and draw the progress bar accordingly.
  • providing user to retry or abort the operation (whether it's copy, move, delete) when it fails on some file(s).

If that's annoying you can always use xcopy or robocopy via command prompt for large number of file operations.

Gani Simsek

Posted 2011-03-25T08:57:00.487

Reputation: 2 510

17If it is necessary because of the way that NTFS works, then why can xcopy do it's job without it? – Björn Pollex – 2011-03-25T09:38:05.850

5"preparing the copy" happens after the list is build and mainly used for computing percentage, time left, drawing progress bar with fancy graphics etc. xcopy doesn't bother with all that. – Gani Simsek – 2011-03-25T09:48:25.897

6Then why did you say that it is "necessary because of the way that NTFS works"? I can only speculate about what Windows does when it is "preparing", but recall that it never did that in Windows XP, and third-party utilities (e.g. TeraCopy) also have near-instant delays between starting the file transfer. – Breakthrough – 2011-03-25T10:55:12.997

2

Looks like I didn't clearly expressed myself. The list is necessary for the file operation, which is common in both cases (i.e. cmd and gui) and doesn't take much time. However, the reasons you see that "preparing to copy" window are because of the graphics, percentage and time computations involved, especially in Aero theme and that's one of the cases where that list is used, which I think is the answer to the question. Since there's no gui in xcopy or robocopy there are no preparing to copy computations. Also, it DID that in XP as well, http://i.imgur.com/UOiRy.png

– Gani Simsek – 2011-03-25T11:49:51.970

And AFAIK, it didn't say "Preparing to copy" for 5 minutes, but usually less then two seconds. – Breakthrough – 2011-03-25T11:59:31.687

That time depends on the specs, especially CPU, of the PC. In XP Mode, I copied a folder which had 4K files in it (total 50 MB) and it showed "preparing to copy" window for 5-6 seconds, quite long enough to take a screenshot. – Gani Simsek – 2011-03-25T12:30:15.007

7This is not true -- you'll get the same message on FAT32. It's not an issue with the filesystem, it's an issue with the FindFirstFile/FindNextFile API. Explorer (who is responsible for the file copy dialog) uses the same API exposed to you, the programmer to display these things, and the Windows API doesn't expose anything about maintaining e.g. allocation tables (In particular, because NTFS doesn't use an allocation table -- that's from FAT land). – Billy ONeal – 2011-03-25T16:49:55.307

1

As answered by Raymond Chen in one of the replies to his original File copy progress dialog post (http://blogs.msdn.com/b/oldnewthing/archive/2004/01/06/47937.aspx#47964), one of the things it does is to get the filesizes for the entire copy operation to make a better guesstimate about the time the copy will take.

R-D

Posted 2011-03-25T08:57:00.487

Reputation: 2 506

1

You have to search in the comments to find where he talks about it. Seems like the blog changed its comment identifier links; here’s a slightly more direct one: https://blogs.msdn.microsoft.com/oldnewthing/20040106-00/?p=41193#comment-119903

– binki – 2018-06-07T20:10:21.657

0

I believe this fancy feature is to calculate the progress bar percentage when each file is copied, so that you can appreciate the lovely progress bar.

Ahmed

Posted 2011-03-25T08:57:00.487

Reputation: 255

-1

To my knowledge Windows checks that it Can dó what you ask for ALL files. This means that e.g. locked files are found up front instead of halfway through causing an incomplete result.

Thorbjørn Ravn Andersen

Posted 2011-03-25T08:57:00.487

Reputation: 291

2Incorrect. It does not check for locked files and very often fails in the middle of actual copy process. – Art Gertner – 2014-07-16T09:12:56.560