How To Use XCopy To Transfer Files

Sometimes we have a job where the only requirement is to copy files from one location to another. For backups or archival purposes, all that is required is a simple copying of files from Source location to the Destination location. XCopy is a simple tool for just that kind of work. A mature program that first appeared in DOS 3.2, XCopy is able to get the job done with ease and elegance, with simple to understand Command Syntax granting it a great deal of customization. In this video, we will explore how to use XCopy as it was meant to be utilized, copying files from a source location to the desired destination, quickly and simply.

xcopy is a Windows copying command that can be executed from a command prompt or from a powershell session powerShell will allow some flexibility to use variables in our command and making it easier to change in the future should the need arise to get started first we need to specify are source folder. And our destination folder now that we have these 2 variables populated we can begin customizing Xcopy’s command syntax, which will determine how the command will behave while copying files and folders. We can tell Xcopy not to stop if it runs into an error using forward Slash C. If we want to include empty folders. We need only specify the forward slash E syntax. We also want to include any hidden files and we can do that using forward slash H to keep file attributes from the source location after they've been copied to destination. We need to use forward slash K if we don't need to see any information about the files as their copied we can quiet the output with forward slash Q If we have read only files that we want to move to the destination. We can do that using forward slash R. To copy all files and folders, we need forward slash S? We want to make sure that ownership an audit settings are copied from the source to the destination using forward Slash X and if we don't want prompted to overwrite each and every file that already exist in our destination. We can do that using forward Slash Y? Our command is now ready to copy files from our source to our destination folder. Now let's check some of the directories to make sure that all the files got moved first will check it in our test folder one and compare that to our test folder 02. Let's use powershell to compare the number of objects in our source location with a number of objects in our destination location. The number of files and folders in each location is exactly the same our Xcopy command was successful. Thank you for watching.