- XCOPY
- Copy a single file
- Insufficient Memory error
- Exit Codes
- Copy Folders and Subfolders using XCopy Command or Easier Way
- What is Xcopy command?
- Can I copy folders and subfolders using Xcopy command?
- Copy folders and subfolders using Xcopy command in Windows 7/8/10
- Situation 1. copy folders and subfolders and contents
- Situation 2. copy folders and subfolders without files
- Situation 3. copy folders and subfolders with NTFS and Share permission
- Easier way to copy files or folders in Windows 7/8/10
- Step by Step guide to copy folders files or folders via AOMEI Backupper
- Verdict
- Copy only changed files (new & modified) in Windows 10
- Replies (9)
XCOPY
Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.
While still included in Windows 10, XCOPY has been deprecated in favor of Robocopy, a more powerful copy tool, which is now built into Windows Server and Desktop operating systems [x]
XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.
XCOPY will accept UNC pathnames.
To always overwrite destination files use the COPYCMD environment variable: SET COPYCMD=/Y
When comparing Dates/Times the granularity (the finest increment of the timestamp) is 2 seconds for a FAT volume and 0.1 microsecond for an NTFS volume.
Copy a single file
In most cases copying a single file is best done with the COPY command. When copying a single file with XCOPY, there is no option to indicate if the destination is a filename or a directory (with the filename defaulting to that of the source file).
In such cases XCOPY will prompt with a (locale specific) message like:
C:\> xcopy foo.txt bar.txt
Does foo.txt specify a file name
or directory name on the target
(F = file, D = directory)?
Adding a wildcard (*) to the end of the destination will suppress this prompt and default to copying as a file:
C:\> xcopy foo.txt bar.txt*
C:foo.txt
1 File(s) copied
This requires the source and target file extensions to be the same length, typically 3 characters.
Insufficient Memory error
Attempting to XCOPY a source file that has a pathname longer than the Windows maximum path length (254 characters) will result in a rather unhelpful ‘Insufficient Memory’ error, the operation will then halt. This bug which has been around for over 10 years makes XCOPY a poor choice for any kind of backup script, use ROBOCOPY instead.
Exit Codes
0 Files were copied without error.
1 No files were found to copy.
2 The user pressed CTRL+C to terminate xcopy.
4 Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
5 Disk write error occurred.
echo F| XCOPY C:\utils\MyFile.txt D:\Backup\CopyFile.txt
XCOPY C:\utils D:\Backup\utils /i
Copy a folder including all subfolders.
XCOPY C:\utils\* D:\Backup\utils /s /i
“It is easier to copy than to think, hence fashion”
COPY — Copy one or more files to another location
DEL — Delete files
MOVE — Move a file from one folder to another
ROBOCOPY — Robust File and Folder Copy
PowerShell: Copy-Item — Copy an item from one location to another
Equivalent bash command (Linux): cp — Copy one or more files to another location
Copy Folders and Subfolders using XCopy Command or Easier Way
You will learn to use XCopy command to copy folders and subfolders for different requirements, not just files. Also, an easier way is prepared. Learn them first and then pick one per your needs.
By Nicky / Last Updated April 7, 2021
What is Xcopy command?
Xcopy is a command that can copy files, directories, and even entire drives from one location to another. It is an advanced version of the copy command that it has additional switches to specify both the source and the destination in detail. And it is useful in particular when copying files from CDROM to a hard drive because it will remove the read-only attribute automatically.
The Xcopy command is available in most current operating systems such as Windows 10, Windows 8, Windows 7, Windows XP, Windows Vista and Windows 98. The Xcopy command is also DOS command available in MS-DOS.
Can I copy folders and subfolders using Xcopy command?
“I have a folder with a lot of subfolders and files in them. Now, I want to copy the folder to another location, but I don’t want to recreate directory structures. Can I use Xcopy command to copy the directory structure of the folder and subfolders to another location?”
As we know, recreating directory structures can be a tedious and error-prone thing, especially if using the right-click method to create multiple structures and folders. So, you may want to copy folders and subfolders by Xcopy command directly. If you don’t know how to achieve it via Xcopy, keep reading to learn the detailed steps.
Copy folders and subfolders using Xcopy command in Windows 7/8/10
To move folders and subfolders in cmd, the most used command syntax would be:
xcopy [source] [destination] [options]
And there are plenty of options and switches for different demands. You can copy folders and subfolders including or excluding files from one location to another location by following the steps in different situations.
Situation 1. copy folders and subfolders and contents
1. Click Start and type cmd in the search box. Right-click Command Prompt from the list and select Run as administrator.
2. Now, when you’re in the command prompt, you can type Xcopy command as below to copy folders and subfolders including contents. For example, you want to copy “test” folder and its subfolders on C drive to D drive, type Xcopy command as:
Xcopy C:\test D:\test /E /H /C /I
/E – Copy subdirectories, including any empty ones.
/H — Copy files with hidden and system file attributes
/C — Continue copying even if an error occurs.
/I — If in doubt, always assume the destination is a folder. e.g. when the destination does not exist.
Xcopy will not copy open files.
Xcopy doesn’t display any progress or completed operations information when executed.
Remember that for folders with spaces in the name or folders larger than 8 characters in length, it is a good idea to put quotation marks around the path as in the figure above or you may get an error.
Situation 2. copy folders and subfolders without files
You can open the Command Prompt according to the steps shown above. Then, type the Xcopy command as below to copy folders and subfolders without files:
Xcopy Source Destination /T /E
/T — Copy the subdirectory structure, but not the files.
/E — Copy subdirectories, including any empty ones.
Situation 3. copy folders and subfolders with NTFS and Share permission
Sometimes, you may need to transfer the NTFS and Share permission together with your folders. Once the Command Prompt is open, you can then type the following command to copy all files and folders and retain its NTFS and Share permissions.
Xcopy Source Destination /O /X /E /H /K
/E — Copy folders and subfolders, including empty ones.
/H — Copy hidden and system files also.
/K — Copy attributes. Typically, Xcopy resets read-only attributes.
/O — Copy file ownership and ACL information.
/X — Copy file audit settings (implies /O).
Actually, there are many syntaxes for the Xcopy command, and you should use different syntaxes for different situations. Under most circumstances, you need to use several syntaxes at the same time. But if one syntax is used incorrectly, the Xcopy command may refuse to work, even worse, you may lose files. Therefore, you must be very careful when using the Xcopy command.
In fact, most users are not familiar with the use of the command line, and you may be confused with a large number of syntaxes. Therefore, you can copy folders and files in an easier way using a third-party migration tool like AOMEI Backupper Standard.
Easier way to copy files or folders in Windows 7/8/10
AOMEI Backupper Standard is a free and reliable backup software for Windows Vista/XP/7/8/10. It allows you to backup folders/files to different places like internal hard drive, external hard drive, USB drive, network and so on. This software has a clear interface and user-friendly design, so, you can figure it out quickly even for the first time.
In addition, this software has many useful features. For example, it supports scheduled backup, which can help you automatically backup folders/files in Daily, Weekly, Monthly, and Event-triggerВ mode. Furthermore, Full backup and Incremental backup are also supported. You can set incremental backup to save both your storage disk space and backup time.
Step by Step guide to copy folders files or folders via AOMEI Backupper
1.В Download AOMEI Backupper Standard, install and launch it.
2. Click Backup and File Backup subsequently.
3. Click Add File or Add Folder to choose the files or folders you want to backup and then click OK.
вњЋ Note: After clicking Add Folder, you can open Filter Settings to set file inclusion/exclusion mask. This function can help you backup files with specific file extension, you can upgrade to paid versions to enjoy it.
4. Select the destination path you want to copy files to. Internal hard drive, connected external hard drive, Cloud drive, shared folder, and NAS are available.
5. (Optional) Click Schedule to set a Daily/Weekly/Monthly under General tab, or select Full and Incremental backup under Advanced tab. Then, click Start Backup.
Verdict
You can copyВ foldersВ andВ subfolders using Xcopy command by the steps shown above. However, many users say that copying failed due to Xcopy not working sometimes, or Xcopy does not copy all files. And in some cases, Xcopy halts because of “Insufficient Memory” error or invalid number of parameters.В
Therefore, using AOMEI Backupper to copy folders or files is a more reliable and convenient method. With only a few clicks, you can copy folders or files to your destination, and its useful features like incremental backup, USB plug in, etc. bring you much convenience.
Moreover, AOMEI Backupper Standard designs for Windows XP/Vista/7/8/10 only, if you are a Windows Server user, you can try another version–AOMEI Backupper Server.
Copy only changed files (new & modified) in Windows 10
How to Copy Only New Files and Changed Files to my backup USB to do a backup.
—- You could do this on Old DOS and Window before they fixed it in Windows 10 —
Her is the Situation:/Problem
I drag a bunch of folders to the destination (my (USB backup drive) and copying begins
Then I get a window that says destination has files with the same name and asks if :
1. I want to replace the files
2. Skip these files
3 let me decide what to do with each individual file
copy «»»»changed»»»» files only — Remember that?
Window 10, in it’s wisdom, no longer seems to have this option — even though the files still have dates and sizes.
I used to be able to say copy ( or move) changed files only. bing, bang, bata boom and it’s done.
Because of this I Must either:
1 not save the updated files- even though they have been updated based on the new file date
2 replace all of the files which is waste of time and resources (there are 3307 files that I copy)
or decide on each file what I want to do on 3307 files also a major waste of my time. That would take me days.
On previous Windows and DOS you could copy changed files only.
——Where is that option in windows 10 operating system? ———
I can buy a simply program like copywiz to do that for $29 dollars or use the dos Xcopy at the command prompt but really? This is the best the new wonderful window 10 can do? Search hardly works and now the Copy command is pathetic too?
Does anyone have any idea what to do besides DOS or paid copy programs?
Also, how much longer will windows 7 be supported by Microsoft.
I ask because MS support is so willing to help that their people say go back to 7. I assume they have no interest in fixing this well know issue. That was a good program and I am considering going back. until windows 10 beta testing is done using all of us as guinea pigs.
Replies (9)
Select Let me decide for each file and then in the File Conflict dialog choose the option to Skip N files with the same date and size:
82 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thank you for this response. It’s an interesting workaround and I will naturally take it under consideration even though it’s a workaround that doesn’t exactly fit my needs as a user and all of my circumstances.
I know we can’t have everything of course and if Microsoft wants to eliminate this method of copying, that has worked well all this time, they can do so. However, what I am still looking for is an answer to this question —
How to make windows 10 work like older versions of windows and even as old as DOS 3 plus. by copying only changed files rather then wasting either my time making individual choices on 3000 plus files or wasting my resources copying all of the 3000 plus files. if having to use yet another work around to do what is so simple to in other older versions of window.s. I can use the proper DOS Xcopy commands at the command promt of course, but this is supposed to be the newest and the best so why would I use DOS to get the job done or have to use a workaround?
I only drive my 1929 ford for show not because I expect it to go 120 MPH in 5 seconds flat.
I wold like the system to copy only changed files as an option when I copy or move a file to another drive or to my backup USB drive
Do you by chance know how to make «that» work?
10 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Hi RoberttWin and thank you for your quick response to this.
Unfortunately, this does no solve the problem because my version of window 10 appear to be different from yours.
Select Let me decide for each file and then in the File Conflict dialog choose the option to Skip N files with the same date and size:
Let me decide I don’t get that option: Hers is what I show.
Notice that my choice is to skip 0 files with same date and size out of ( in this case) 720 files although it shows 720 files with the same date and size.
I don’t know why that is. Do you know how to make it read the correct number?
Also this give me a choice of which to keep if I copy the files.
Is it not true that If I am making a —COPY — elsewhere that I want to keep the original files? If however I din’t want the originals to stay in place that I would —MOVE — the files. Have he definitions of these words changed or is Microsoft now using offshore programmers who don’t really understand the US language that well.
I want to keep both with the — Same — Name. If I want to copy why would they even ask?
If I had the skip option on my windows 10 version your solution might work though — unless it renames the files which I don’t want.
Thanks — I hopefully await your reply
5 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Well I found other posts which I missed before. Here seems to be the problem as of Aug 31 2015 but not the answer.
No it doesn’t work according to MS — and it has not been fixed in over one year. see below.
Windows 10 — Copy and paste functionality in file explorer
Each day, I copy a number of files from my office computer to my home computer as a back up. As I update these files in my office computer, I copy and replace the older versions on my computer at home.
When I did copy and replace in Windows 7, for each file name that was already existing in my home computer, Windows 7 would give me a message for copy and replace giving the date of file modified and label it as Newer. For all «newer» files, I would them accept the copy and replace function.
I found this functionality in Windows 7 extremely useful since it would protect me from accidental replacement of a newer version with an older version. Just by checking the «Newer» word in the prompt, I would click yes.
This functionality is missing in Windows 10. It only provides an option where I have to manually compare and determine the newer version, and I find this loss of functionality very irritating (it was so much easier when Windows 7 did the compare and labelled newer files). I can’t understand why Microsoft removed this functionality.
I called Microsoft support but the only solution they gave me is to go back to Windows 7 (a suggestion that I found to be extreme).
Am I the only one missing this functionality? Is there a work-around for this?
Any help or advice would be greatly appreciated as I am missing this functionality — I use it everyday.
Is there any hope that Microsoft will add this functionality to Windows 10 in the future?
Thank you very much.
11 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Notice that my choice is to skip 0 files with same date and size out of ( in this case) 720 files although it shows 720 files with the same date and size.
1. I see 760 conflicting files. Where are you getting the 720 number from?
2. You’re wrong, the two sets of files don’t have the same date and size. The files in K: are all newer than those in F:, as shown clearly by the fact that their dates are in bold text. So even if the sizes match (since neither size text is in bold), the dates don’t and so the files are not necessarily the same.
Is it not true that If I am making a —COPY — elsewhere that I want to keep the original files? If however I din’t want the originals to stay in place that I would —MOVE — the files.
Who says the files in the original location i.e. F: won’t be kept? The dialog is clearly asking whether in the target folder i.e. K:, you want to keep copies of the original set of files from F:, or you want to retain the new files already in K:.
Have he definitions of these words changed or is Microsoft now using offshore programmers who don’t really understand the US language that well.
No offence, but just because you didn’t understand the dialog doesn’t mean others don’t. I’ve been around the world enough to have met lots of foreigners who could speak English better and write both English and code better than their counterparts here. Personally, when I’m faced with genuine OS issues I couldn’t care less about the background of the developers. They’re MS employees, that’s all I know, and so I want them to fix their damn mistakes wherever they are, be it America, China, Russia or Addis Ababa.
I want to keep both with the — Same — Name.
You can’t keep both sets of files with the same name in the same folder. This has never been possible. All you can decide to do with the dialog above is, as I’ve already said, choose to keep the newer files in K: or overwrite them with the older ones from F: (or keep both versions in K: with the ones from F: being automatically renamed). The original files in F: will of course be left untouched since you’re copying and not moving, exactly as you want.
If I want to copy why would they even ask?
They’re asking because the file names are conflicting. Couldn’t be simpler. Now you decide which version of the files you want ending up in K:.
With a multi-file copy/move Win10 doesn’t prompt you for each file whether it is newer or older than the one with the same name in the target folder. Instead it shows you a dialog where it highlights which file in each pair is newer, and which file in each pair is bigger. If you select both of a pair then it will rename the file being copied so both versions can co-exist in the target folder.
Now is the current implementation perfect? Of course not. For example see the following case:
As you can see the Source versions of Files 1 & 3 are newer, but the Target versions of Files 2 & 4 are newer. Now what if one wants to end up with only the newer files in the Target folder (i.e. copy Files 1 & 3 from Source but leave Files 2 & 4 untouched in the Target)? Currently there’s only a Select All checkbox for each column, so one would have to manually select Files 1 & 3 from the first column and Files 2 & 4 from the second. This is obviously impossible when one has hundreds of files in each column to select.
Instead if they had options like i) Select only the newer files, ii) Select only the older files, iii) Select only the smaller files and iv) Select only the bigger files, then IMO the dialog would be far more useful.
Edit: Here are the XP and Win7 file conflict dialogs:
Where’s the «copy «»»»changed»»»» files only» option you were talking about?