Commands · Command

CommandWindows

xcopy

xcopy source destination [options]

An older Windows command for copying files and directory trees, largely superseded by robocopy but still present and occasionally used in legacy scripts.

// FLAGS

/scopy directories and subdirectories, except empty ones
/elike /s but also copies empty directories
/iassume the destination is a directory when copying multiple files
/ysuppress overwrite confirmation

// EXAMPLE

xcopy C:\Data D:\Backup /e /i /y — copies the entire Data folder structure, including empty folders, without prompting.

// GOTCHA

Microsoft's own documentation recommends robocopy for anything new — xcopy lacks robocopy's resume/retry/mirror capabilities and mostly turns up in older scripts.

// RELATED COMMANDS