The ultimate guide to copying files and folders with Xcopy (2023)

TwitterFacebookLinkedIn

this oneXcopyrepresentative tooladvanced copy,is a popular command-line utility for copying large amounts of data in Windows. compared to traditionalcopyXcopy has more features and switches that give you more control when copying or moving files and folders.

No readers? Check out this linked video tutorial!

Not watching the video? Make sure your ad blocker is disabled.

This tutorial will show you how to use Xcopy in various file copying scenarios. From copying individual files, multiple directories, applying filters or exclusions, etc. Finally, you'll gain the knowledge to use Xcopy for everyday file copying tasks.

Let's start!

Require

To follow the examples in this tutorial, you'll need the following.

  • Windows computer (server or client). Xcopy is built into Windows, you don't need to download anything else. This guide uses Windows 10 Build 1909.
  • Xcopy runs from the command line or PowerShell. This article assumes you already have one open.

Understanding the xcopy command

Xcopy is a command-line utility available by default since Windows 98. You can find this tool at%WINDIR%\system32folder with the name of the executable filexcopy.exe.

compared to WindowscopyThe Xcopy command is more efficient in copying files and directories. In addition, Xcopy has more options, which makes it easy to customize and allows you to control the behavior of file copying.

an advantage

There are several benefits of using Xcopy that you will learn about in this guide. However, here are some benefits of using Xcopy.

  • Faster process of copying large number of files and directories.
  • Simplify application deployment.
  • The source directory structure can be copied as is.
  • Copy files while preserving ownership andAccess Control Lists (ACLs)information.
  • Copy and overwrite read-only files.
  • Files can be excluded based on filename, extension or path.
  • Newer files can be identified, useful for differential backups.
  • Integrate and use scripts.

limit

As great as Xcopy is, it is not without limitations. While these limitations may not be critical, it's best to be aware of them before you begin.

  • Unable to copy open file.
  • don't support itWindows Volume Copy Service (VSS).The lack of VSS support makes Xcopy unsuitable for backing up Live OS volumes.
  • An out of memory error occurs when the path plus file name is longer than 254 characters.

Xcopygrammatical reference

Xcopy allows you to perform various file and folder copy operations. But first you need to understand the syntax and options. There are many options for changing the way Xcopy works. To help you better understand these options, they are discussed in detail in the table below.

The first path specification refers to the source file; the second path specification refers to the object file.

xcopy [source] [destination] [options]
  • [They]– Path to the file to be copied (wildcards may be used). You should specify the drive, path and file you want to copy.
  • [Goal]- The path name of the new file. If no destination path is specified, the command will copy the file to the same path as the source.
  • [option]- can be one of the following options in the table below. You can also see these options by running itcopy of /?command or accessXcopy - online documentation.

that option

to changeexplain
/ACopy the file containing the archiveAttributes.
/riceCopy the files with the archive attribute set, then disable the archive attribute on the destination. Use this option when making routine backups.
/HCopy hidden and system files and directories. The default is N.
/T:mm-dd-ggggCopies only files with modification dates on or after the specified date. Without this option, the command copies only those files with a newer date/time than the target.
/UOnly files that already exist in the destination are copied.
/SCopy folders and subfolders recursively, excluding empty folders.
/ERecursively copy folders and subfolders, including empty folders.
/EXCLUDE:Date1[+Date2][+Date3]…Specifies a text file containing a list of strings corresponding to absolute file paths to exclude.

targeted options

to changeexplain
/IUsing this option assumes that the target is a directory and creates one if the target does not exist. If this option is omitted, the command prompts you to confirm whether the target is a directory or a file.
/ROverwrite read-only files.
/TCreate a recursive folder structure on the target without copying files. This option does not include copying empty folders. To include empty folders, use this option with the /E option.
/KFile attributes are preserved when copying. Otherwise, the command resets the read-only attribute.
/NCopy files using theirshort file name.
Copy the file, including the attributes andAccess Control Lists (ACLs)information.
/XCopy files includeFile control itemsand ACL information (implies the use of /O).

copying possibilities

to changeexplain
/WAsk for a keystroke before copying starts.
/PAsk (Y/N) before creating each file.
/YSuppresses confirmation to overwrite the destination file (if it exists).
/-YAsks for confirmation to delete existing target files.
/VMake sure the source and destination files are the same size.
/CIgnore the error and force the command to continue copying.
/OtherOnly the symbolic link is copied, not the target file of the link.
/GCopy encrypted files to destinations that do not support encryption.
/Jcopy the file without using itinflatorThis switch is useful when copying very large files.
/QPrevents file names from being displayed when copying.
/FShow full source and destination file path when copying.
/LShow only files to copy without copying. This switch is useful when testing an Xcopy command with several options to evaluate the expected results.
/ZCopy the files in reboot mode. With this option, the command gracefully stops copying files during a network outage. Replication will resume after the network connection is re-established.

Using Xcopy: Application examples

Now that you're familiar with Xcopy's syntax and options, it's time to start using it by combining one or more options. In the following sections, you'll explore many different scenarios for copying files and folders with Xcopy.

list of files to copy

If your file server contains a large number of files that you want to copy, preferably to a backup location, it is ideal to try the xcopy command first. One situation where you might want to test Xcopy is when you combine multiple Xcopy options.

for/LSwitching with Xcopy allows you to simulate what would happen if you issued a command by listing the files that would be copied. This way you can check that your command is copying all the files you want.

XCOPY C:\Workarea\XCopyDemo C:\Workarea\XCopyDemoFolder /L

copy one file

The most basic thing you can do with Xcopy is copy a file from a source to a destination without using any options. For example, the following command copies a text file to the target directory, keeping the file name unchanged.

XCOPY C:\Workarea\XCopyDemo\NewFile.txt C:\Workarea\XCopyDemoFolder folder
(Video) How To Use XCopy To Transfer Files

You can also copy the source file and rename the destination file by running the following command.

XCOPY C:\Workarea\XCopyDemo\NewFile.txt C:\Workarea\XCopyDemoFolder\AnotherFile.txt

Copy the files to a new folder

With Xcopy, you can instantly copy files and create destination directories. For this you need to add this/IXcopy command options.

For example, the following command fromC:\Workspace\Demonstrationsmap behindD:\Workspacebinder. If the target folder does not exist, Xcopy will create a target folder with/Ipossibility.

XCOPY C:\Workarea\Demo D:\Workarea /I

Copy all files and folders recursively

In addition to copying files from one folder to another, Xcopy also allows recursive copying of folders and files. There are two ways to recursively copy - with and without empty folders.

To copy all files and directories, ignoring empty directories, add the following/SAdd the options at the end of the xcopy command as shown below.

XCOPY C: D: /S

Alternatively, to include empty directories during recursive copying, add:/Eoptions, not commands.

XCOPY C: D: /E

includehidden and system files

By default, Xcopy does not include hidden and system files in the copy operation. However, if you need to force Xcopy to include hidden and system files, add the following/Hdirect.

The following command recursively copies all files, including hidden and system files. This command also ignores errors, creates a destination folder, and overwrites existing files.

XCOPY C:\Workarea\Documents D:\Workarea\Documents /S /H /C /Y

Keep file attributes read-only

Another attribute that Xcopy can handle and preserve is the read-only attribute of files. By default, when Xcopy copies a read-only file, it removes the read-only attribute of the target file. To prevent Xcopy from removing read-only attributes, add the following/Kdirect.

For example, the following command copies a read-only file to another location, and the resulting target file still has the read-only attribute. This command also overwrites the target file if it exists.

XCOPY C:\Workarea\XCopyDemo\NewFile.txt D:\Workarea /I /K /Y

As a side effect of keeping the file read-only, Xcopy cannot overwrite the same file in subsequent copy operations. However, you can force Xcopy to overwrite read-only files by adding/Rto change.

XCOPY C:\Workarea\XCopyDemo\NewFile.txt D:\Workarea /K /R /Y

Filter files to copy

Let's say you have multiple files in the source folder and subfolders that you want to copy. Xcopy allows you to enter wildcards to filter files to copy.

For example, the following command just copies。CSRecursively expand from the rootC:pogon na rootOther:drive. This command also ignores errors and overwrites existing files without asking for confirmation.

XCOPY C:\*.cs E:\ /S /C /Y

Exclude files and folders from copies

A powerful feature of Xcopy is the ability to exclude files from the copy process. To use this feature you can use/turn offto change. This switch accepts the name of the file containing the list of exceptions.

(Video) 🔥🔥 How to Copy Folders using cmd | Xcopy Command Tutorial

First, you must create or have a file that contains a list of exceptions. For example, you can create a file named "turn off.txtContains the following entries. As you can see, excluded files can contain specific file names, file extensions, and folders as entries.

xyz.txtExclude.txt.pdf.png\排除\

To run Xcopy with exceptions, run the following command and specify the full path to the exception file/turn offto change. The command usesC:\Workarea\XCopyDemo\Exclude.txtdocument.

XCOPY C:\Workarea\XCopyDemo C:\Workarea\Backup /S /Y /Exclude:C:\Workarea\XCopyDemo\Exclude.txt copy code

result? Xcopy starts the copy file but skips itxyz datoteka,turn off.txt, All files.pdfi.pngextension and all files underturn offContent.

Perform a differential copy

If you need to back up files from one location to another, Xcopy offers an option that allows you to perform differential backups. A differential backup does not copy all files, only those files whose modification date is on or after the date you specify/D:m-d-yto change.

For example, to copy only files with a modification date of April 1, 2021 or later, run the following command. Additionally, this command performs a recursive copy, ignoring errors and overwriting existing files at the destination.

XCOPY C:\Workarea\XCopyDemo C:\Workarea\Backup /D:04-01-2021 /S /C /Y

If no date is specified during the listing/DWith this option, Xcopy only copies source files that are newer than the destination file.

Copy files based on archive attributes

Typically, backup programs remove the file archive attribute after a backup operation. After a file has been modified (ie edited and saved), Windows automatically resets the file's archive attribute.

When using Xcopy to script file backups, you can use the archive attribute to specify whether the file should be copied or backed up.

You can use the following to copy files with archive attributes/Ai/riceto change. Which of these switches you use depends on whether you want to preserve the archive attribute of the file.

The following command performs a recursive copy of only files with the archive attribute. To do this, the target file retains the archive attribute after copying/Ato change.

XCOPY C:\Workarea\Demo D:\Workarea\Test /A /S /Y

Instead, to remove the archive attribute of the source file after copying to the target, specify:/riceSwitch instead.

XCOPY C:\Workarea\Demo D:\Workarea\Test /M /S /Y

Preserve file ownership and ACL data

Imagine backing up your entire profile folder. Each file can have a different owner or unique permissions. If you need to restore these files, they must have the same owner andpermitsUntouched.

related:How to manage NTFS permissions using PowerShell

This way, the whole process seems to go smoothly and the user continues to access the files as before. First, however, you must ensure that these files are backed up while preserving existing ownership and permissions.

To copy files and preserve owner and ACL information, addThe parameter isxcopyThe commands are as follows.

XCOPY C:\radni prostor D:\rad /O /I /Y

In addition to storing owner and ACL information, you can also include these files.audit items.If your organization requires it, it can be useful to copy the audit settingsGroup Policy Objects (GPOs)Check the file.

(Video) Xcopy vs Robocopy : Function Comparison and Alternative

To turn on file monitoring settings when copying files with Xcopy, use/Xto change. this one/Xswitch meansThere are also switches, so you don't have to use both.

related:What is Group Policy and how does it work? (in detail)

XCOPY C:\radni prostor D:\rad /X /I /Y

Copy files and folders over the network

In addition to copying files between different locations on the same or different hard drives, Xcopy can also copy files over a network. Unfortunately, copying files over the network is not always reliable. There may be brief interruptions and, in some cases, a complete loss of network connectivity.

Fortunately, you can run Xcopy in bootable mode. That is, even if replication stops due to a network error, it can continue after the network connection is re-established. To run Xcopy in restart mode you need to add the following/Zdirect.

For example, the following command fromC:\Workspacefolder to a network location. this one/ZThis parameter starts Xcopy in restartable mode.

XCOPY C:\Workarea "\\SERVER01\Backup" /S /Z

for/ZIf the switch is activated, Xcopy also displays the file copy progress in percentage.

Copy files using bufferless I/O

Buffered I/O is how the operating system buffers disk reads and writes to the file system cache. Although buffering can speed up subsequent reads and writes to the same file, it comes at a cost. Therefore, bufferless I/O (or raw file copy) is the preferred method for copying large files.

This copy method reduces the load on the file system cache and prevents large amounts of file data from easily flushing the file system cache.

To copy large files with bufferless I/O, you can add the following/JSwitch to the Xcopy command as shown below.

XCOPY C:\Workarea\abc.mp4 D:\Temp /I /J

Copy the file with confirmation

Like any other task, copying files may not always give 100% successful results. Even without obvious errors, some files can get corrupted during transfer.

With Xcopy you can use this/VAfter copying by size, the switch checks whether the destination and source files are the same. Identical source and destination files indicate that the copy process was successful and the files are intact.

The following command copies all filesC:\Workarea\XCopyDemoarriveC:\Workspace\Backupand browse each file with/Vto change. this one/FThis switch displays the full paths of source and object files.

XCOPY C:\Workarea\XCopyDemo C:\Workarea\Backup /F /H /S /X /V

Copy the encrypted files

Xcopy also supports copying encrypted files to destinations that do not support encryption. for/GWith the switch, Xcopy copies the encrypted source file and creates a decrypted destination file.

This copy method is especially useful when backing up encrypted files to network shares or files that are not encrypted.Encrypted File System (EFS)roll.

Xcopy C:\Workarea\XCOPYDemo C:\Workarea\XCOPYDemoFolder /S /G

copy the folder structure

In some cases, the backup script or program may require you to pre-install the destination before copying files from the source. If you want, you can use Xcopy to copy the original folder structure without the contents.

To do this, run the xcopy command/Tto change. for/TCauses xcopy to copy only the directory tree to the target, ignoring empty directories.

you can also add/ESwitch to a command that includes an empty directory, as shown in the example command below.

(Video) Copy Files to Multiple Computers Using xcopy

Xcopy C:\Workarea\XCOPYDemo C:\Workarea\XCOPYDemoFolder /T /E

common mistakes

If something can go wrong, it probably will. The same is true if you copy files independently of the volume. The following are the most common Xcopy errors you may encounter.

Invalid number of arguments

This error usually occurs when the command you type contains spaces. To avoid this error, when entering a source or destination path that contains spaces, enclose the path in double quotes.

For example, if the pathC:\Documents and Settings, the entrance way is"C:\Documents and Settings".

Unable to perform cyclic replication

This error occurs when the source directory you are copying contains a destination directory. In this case, xcopy will start a loop and generate an error. When using Xcopy, to copy all directories and subdirectories, the destination must be a completely separate directory or disk.

parsing error

This error occurs when you enter incorrect or invalid syntax in a command. For example, this error may occur if you specify the path in quotation marks, but the closing quotation mark is missing.

For example, the target path for the following command is missing double quotes.

Xcopy C:\Workarea "C:\Workarea\XCopy Demo /S /I /E /Y

exit code

Xcopy returns the exit code of the operation, which you can use to determine whether the operation was successful. Exit codes are useful, especially if your task or script performs actions based on the exit code it receives.

The command shell stores exit codes%errorlevel%Changing. Your code can then check the value of this variable to determine the result of the xcopy operation.

Below is a table of all Xcopy exit codes.

exit codePurpose
0This exit code indicates that no error occurred.
1This exit code means that Xcopy did not find any files to copy.
2This exit code means pressing CTRL+C to exit Xcopy.
4This exit code indicates that an initialization error occurred, either because there is not enough memory or disk space, or because you entered invalid syntax.
5This exit code indicates that an error occurred while writing to disk.

Scripting with Xcopy

In addition to using Xcopy interactively, you can get additional benefits if you use it to automate tasks through scripts. Below are some examples that show how to use Xcopy in scripts.

Xcopy batch script for copying data with error handling

This sample batch script recursively copies all files using error handling logic. Depending on the error or exit code, the script will return a message with the reason for the error.

To create a batch file, open a text or code editor of your choice, copy and paste the code below into the editor, and save the file asCopy complete.bat.

@echo offrem This batch file copies all source files in all directories and subdirectories from source path (%1) to destination path (%2) xcopy %1 %2 /s /eif errorlevel 4 goto lowmemoryif errorlevel 2 goto abortif errorlevel 0 goto exit :lowmemoryecho There is not enough memory to copy the file, or invalid drive or command line syntax is returned. goto exit:abortecho You pressed CTRL+C, the copy operation was aborted. goto exit:exit

Then, to run the script, find its name in the command line or PowerShell, followed by the source and destination folders.

pycomplete.bat map xcopydemo xcopydemo
The ultimate guide to copying files and folders with Xcopy (1)

Xcopy batch script to move data

Xcopy has no built-in functionality to move files and folders from source to destination. However, to work around this, you can create a script that first copies the files and then deletes them from the source.

The code below copies the file to the destination. If the copy process is successful, the script will delete the source files. Copy the code below and save it in a file namedmove the file.bat.

rem batch file to move files is not 0 echo Copy operation failed.

Then run thismove the file.batTo create a batch file, search for its name in the command line or PowerShell, followed by the source and destination paths, just as you did in the previous example.

(Video) The Easy Guide To Automatic Backup in Windows with XCOPY

movefiles.bat map xcopydemo xcopydemo

diploma

If your job is to bulk copy files or backup files, Xcopy is a great tool to make your job easier. Xcopy provides accurate and fast file copying results and offers many options to customize the behavior according to your needs.

FAQs

How do you Xcopy copy files and folders? ›

Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory. You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

How to copy all files and folders and permissions in xcopy command? ›

5. Run the XCOPY command and include the following switches: "/E" to copy directories and subdirectories, even if they are empty; "/H" to copy hidden and system files; "/K" to copy attributes; "/O" to copy file ownership and ACL data; and "/X" to copy audit settings .

Does xcopy still work in Windows 10? ›

Xcopy Command Availability

This command is available from within the Command Prompt in all Windows operating systems including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows 98, etc.

How do I xcopy multiple folders? ›

Steps to copy files to multiple destinations

The Xcopy command Xcopy Source [Destination] /s copies files including all the sub-folders. We will use the For loop to copy files to multiple destinations using this command.

Is robocopy faster than xcopy? ›

Usually, Robocopy will be the faster alternative in most cases however the most significant difference is that robocopy has a retry option where as xcopy does not retry on errors.

What is the difference between xcopy robocopy and copy? ›

Starting with the definitions, the "copy" command is used for copying files or data, and "Xcopy" is used to copy multiple files or complete directory trees from one directory to another, etc. Finally, "Robocopy" replaces "Xcopy" with various options.

How to copy all files and folders in cmd? ›

If you want to create a new destination folder for a set of copied files, enter the directory for the destination folder (including the destination folder itself) in conjunction with the "robocopy" command. You can copy all files in a directory by typing copy *[file type] (e.g., copy *. txt ).

What is the difference between xcopy and disk copy? ›

In contrast, XCOPY can copy between different formats (e.g., the contents of a 3.5" double-sided, double-density floppy can be copied to a 5.25" single sided, double-density floppy). DISKCOPY will copy hidden or system files, XCOPY will not. DISKCOPY resets the archive attribute; XCOPY does not.

What is the robocopy command to copy all folders and subfolders? ›

The easiest way to copy a folder with all files and subfolders is to run this command: robocopy c:\temp\source c:\temp\destination /E /DCOPY:DAT /R:10 /W:3. The /E switch tells Robocopy to copy all subfolders, including empty ones. If you don't want to copy empty subfolders, use the /S switch.

Is xcopy obsolete? ›

In 2007 XCOPY was deprecated in favor of Robocopy, but it has since been given a reprieve and some new features added.

What are the limitations of Xcopy? ›

Limitations. XCOPY fails with an "insufficient memory" error when the path plus filename is longer than 254 characters.

What is the Windows alternative to Xcopy? ›

It is a wise move to choose Xcopy alternative when you facing Xcopy not working or fails to copy files issue. AOMEI Backupper is able to copy files from one location to another in another way. For Windows Server Operating Systems users, AOMEI Backupper Server is of much more help.

How do I copy all folders at once? ›

If you need to copy a file to multiple folders, you can hold down the Ctrl key, and drag the file or folder on to each folder you want to copy it to.

How do I copy all folders? ›

To copy the item: click Ctrl+C. Navigate to the folder where you want to move or copy the item to, and then click Ctrl+V.

What switch do you use with xcopy or robocopy to copy subdirectories? ›

Syntax and switches in MS-DOS window
Optional switchesDescription
/eCopies any subfolder, even if it's empty.
/wPrompts you to press a key before copying.
/cContinues copying even if errors occur.
/iIf the destination doesn't exist, and you're copying more than one file, this switch assumes that the destination is a folder.
18 more rows
Apr 28, 2023

Why use xcopy instead of copy? ›

XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail. XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute. key source : Pathname for the file(s) to be copied.

What is the disadvantage of Robocopy? ›

Disadvantages: No image based recovery. Backup Speed based on network traffic and architecture (although, this is true of every backup program) No tech support if something goes wrong.

What is the fastest copy method in Windows 10? ›

Hold Ctrl and click multiple files to select them all, no matter where they are on the page. To select multiple files in a row, click the first one, then hold Shift while you click the last one. This lets you easily pick a large number of files to copy or cut.

How fast is Xcopy compared to copy? ›

The average Disk Read Transfer is better for XCopy (76.15 MB/Sec vs. 75.28 MB/Sec), the minimum Disk Read Transfer is better for Robocopy (4.74 MB/Sec vs. 0.00 MB/Sec) and the maximum Disk Read Transfer is better for XCopy (218.24 MB/Sec vs. 213.22 MB/Sec).

Can you move files with Xcopy? ›

Copying Files to a New Folder

With Xcopy, you can copy files and create the destination directory on the fly. To do so, you need to append the /I option to the Xcopy command. For example, the command below copies the files from the C:\Workarea\Demo folder to the D:\Workarea folder.

What is the difference between E and S in Xcopy? ›

/D:(date) - Copies only those files in the source directory that have been changed on or LATER than the specified date. /S - Copies all files in the current directory and in any subdirectory within it. /E - Copies subdirectories, even if they are empty. If you use this option, you must use the /S option also.

How to copy files and folders faster using command prompt? ›

How To Copy Files Using Command Prompt Step by Step
  1. copy c:\myfile. ...
  2. copy *. ...
  3. copy d:\example.xls. ...
  4. To find cmd, go to Start and type cmd into the search box. ...
  5. Xcopy C:\test D:\test /E /H /C /I. ...
  6. Open EaseUS Todo PCTrans on both of your computers. ...
  7. Make sure you have chosen the right transfer direction.
Apr 13, 2023

How do I copy all files in a folder quickly? ›

Once the files or folders are highlighted, press the keyboard shortcut key Ctrl + X to cut or Ctrl + C to copy, or press Delete to delete.

Is there a GUI for RoboCopy? ›

Microsoft used to put out a free utility called RoboCopy GUI that helped setting up the parameters for robocopy and made it easier to copy/paste pathnames when setting up a complex command where you need to exclude things like most of AppData.

How do I use Xcopy? ›

Use the Windows XCOPY command to copy the stored files from within this folder to another location.
  1. From the desktop taskbar, click on [Start], and select [Run]. ...
  2. In the Open field, type cmd, then click [OK]. ...
  3. At the command prompt, enter the XCOPY command then press the [Enter] key to execute the command.

How do I Xcopy a full disk? ›

Method 1. Using Xcopy Command to Clone Hard Drive
  1. Go to Start and type "cmd" into the search box. Then select Command Prompt (Admin) to open CMD.
  2. Type down xcopy c:\ f:\ /s /e /h /i /c /y and then press Enter to copy all files and subdirectories from drive C to drive D. ...
  3. Wait for the process to be complete.
Feb 22, 2023

What command can copy all files directories and subdirectories? ›

Use the cp command to create a copy of the contents of the file or directory specified by the SourceFile or SourceDirectory parameters into the file or directory specified by the TargetFile or TargetDirectory parameters.

How do I copy all subdirectories and files? ›

Copying Directories with cp Command

To copy a directory, including all its files and subdirectories, use the -R or -r option. The command above creates the destination directory and recursively copy all files and subdirectories from the source to the destination directory.

How do I copy a folder and subfolders in CMD? ›

To move folders and subfolders in cmd, the most used command syntax would be:
  1. xcopy [source] [destination] [options]
  2. Xcopy C:\test D:\test /E /H /C /I.
  3. Xcopy Source Destination /T /E.
  4. Xcopy Source Destination /O /X /E /H /K.

What is the benefit of Xcopy? ›

XCOPY command can exclude files based on file names or extensions. XCOPY will automatically delete the read-only attribute when copying files from the CDROM to the hard drive. XCOPY command can recursively copy all files including subdirectories and can copy the source directory structure as it is.

Does Windows 11 have Xcopy? ›

To use the xcopy app, type cmd into the Windows 11 desktop search tool and select the Command Prompt app from the list of results. Type or paste the xcopy command into the prompt and press Enter.

How do I copy only new files with Xcopy? ›

Tips: To copy only updated files with XCopy, you have two options, namely using /s /d, or /i /d /y. And there are something you need to be aware: This first option will copy files that does not exist in the destination folder if you use /d parameter without specifying a date. To avoid it, you could add the /u switch.

Where is Windows Xcopy located? ›

xcopy.exe is located under C:\Windows\system32\xcopy.exe . There also exists a 32-bit version under C:\Windows\SysWOW64\xcopy.exe if you're running an x64 version of Windows.

Is there a way to extract files from multiple folders? ›

Here's how you extract all the files within a compressed folder at once.
  1. Click to highlight a compressed folder.
  2. Click the Extract tab.
  3. Click Extract all.
  4. Click Browse, and then select a location to extract the folder to.
  5. Click Extract.

How do I copy multiple files quickly? ›

Windows 10 and 11 Clipboard Tool

Now, open a document, web page, or other content and copy multiple items using the Copy command or Ctrl + C keystroke. You can copy text, images, and hyperlinks in this way. Open to where you want to paste the content and press Win key + V to open the Windows clipboard tool.

What is the copy command to copy all files in a folder? ›

Use the cp command to create a copy of the contents of the file or directory specified by the SourceFile or SourceDirectory parameters into the file or directory specified by the TargetFile or TargetDirectory parameters.

Which command is used to recursively copy the files? ›

The -R option is used to copy a directory and all of its subdirectories and files recursively.

How do I sync folders using xcopy? ›

The command “xcopy folder1 folder2 /D /E” will copy all the folders and files from folder1 to folder2. If a file exists in folder 2 that is newer or the same as a file in folder 1, the file will not be overwritten. So to do it both ways, you can do as above and then the command “xcopy folder2 folder1 /D /E”.

Can xcopy copy files? ›

XCOPY copies files or groups of files to and from directories. Especially useful for copying data to and from a fixed disk. The first path designation specifies the source file(s); the second path designation specifies the target file(s). A source designation must always be provided.

How do I copy all files and folders in DOS? ›

To copy all files including hidden files, use the xcopy command. Copy the autoexec. bat, usually found at root, and copy it into the Windows directory; the autoexec. bat can be substituted for any file(s).

Can you move files with xcopy? ›

Copying Files to a New Folder

With Xcopy, you can copy files and create the destination directory on the fly. To do so, you need to append the /I option to the Xcopy command. For example, the command below copies the files from the C:\Workarea\Demo folder to the D:\Workarea folder.

What are the limitations of xcopy? ›

Limitations. XCOPY fails with an "insufficient memory" error when the path plus filename is longer than 254 characters.

How to use xcopy in cmd? ›

Use the Windows XCOPY command to copy the stored files from within this folder to another location.
  1. From the desktop taskbar, click on [Start], and select [Run]. ...
  2. In the Open field, type cmd, then click [OK]. ...
  3. At the command prompt, enter the XCOPY command then press the [Enter] key to execute the command.

Is Xcopy obsolete? ›

In 2007 XCOPY was deprecated in favor of Robocopy, but it has since been given a reprieve and some new features added.

Why use Xcopy instead of copy? ›

XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail. XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute. key source : Pathname for the file(s) to be copied.

How to get a list of all files in a folder and subfolders using CMD? ›

Type dir /A:D. /B > FolderList. txt and press Enter to generate a top-level folder list. When the list is complete, a new, blank prompt with a flashing cursor will appear.

How to copy folders using cmd? ›

The first way involves using the Command Prompt. “ Xcopy ” is short for “extended copy” and this command allows you to transfer folder structures to a new storage location without duplicating the files. The command line uses the “ /t ” switch to do so.

How do I copy all files at once? ›

Once the files or folders are highlighted, press the keyboard shortcut key Ctrl + X to cut or Ctrl + C to copy, or press Delete to delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

What is the substitute of Xcopy? ›

It is a wise move to choose Xcopy alternative when you facing Xcopy not working or fails to copy files issue. AOMEI Backupper is able to copy files from one location to another in another way. For Windows Server Operating Systems users, AOMEI Backupper Server is of much more help.

Videos

1. 5 xcopy Commands
(Ramo Monreal)
2. Xcopy : Copy a Folder to Another Folder and Retain its Permissions
(microsoft lab)
3. How to Easily Copy Files and Directories in MS DOS
(Adventures in Nostalgia)
4. How to copy large amounts of files in Windows
(Chris Titus Tech)
5. The Ultimate Guide to Robocopy
(ATA Learning)
6. How To Copy The Files and Folders using COMMAND PROMPT DOS By Easy Method|Cmc It Program
(CMC IT PROGRAM)

References

Top Articles
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated: 10/20/2023

Views: 6415

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.