I am curious to know how computers execute "copy" and "paste" of large folders. I've read that copy and paste of text between different processes or same process is achieved by saving the content into RAM and then copying it from there to destined location.
So, how does computer instructions flow while copying a folder of say 10 GB on a machine which has 2 GB RAM and 4 GB max virtual memory. Is file copy is different from text copy.
I think it's basic question but any links or insights appreciated.
Best Answer
Clipboard doesn't have to hold entire file. When you copy a file (or files), only its path is put into the clipboard. It's also marked as a file - clipboard keeps track of its content's type, like plain text, formatted text, file, image, Word text etc. This is why you can't for example open up an image in Paint, press Ctrl+C and then paste it into a directory - because you have copied a picture, and directories hold files, not pictures.
When you paste a compatible content (i.e. file(s) and/or folder(s)) into a directory, some application will handle the copying/moving operation. By default it will be the
explorer
process (the same one that's responsible for displaying Start menu and all file explorer windows), but some apps may replace it.[1]What happens now depends on what you're doing:
Annotations:
[1]. For example TeraCopy, which is a nice advanced copy window replacement.
[2]. Physical file structure on the hard disk doesn't resemble the directory structure - it's flat and all hierarchy information is stored in a separate part of the partition. How it's exactly done depends on filesystem (for example see MFT). That information block holds all the information about file locations etc. So when you move a file inside one partition, there's no need to move it physically - only the path information has to be updated.
[3]. Not literally, nothing will be split on the hard disk. The program that handles the copying process will work like there are multiple separate chunks, but the original file will be untouched. It's purely virtual.
[4]. You can see it when using TeraCopy: the "predicted progress" doesn't work like on fixed drives, instead the "real progress" catches up with it, then "predicted progress" is expanded and so on. Explorer's default copy window has USB hiccups too.