Tired of all the prompts while copying files? Here is a better/efficient way to copy files around. This command is especially helpful when copying tens of gigabytes of files, for example backing up your c drive into an external hard drive.
Here we have some files in the source folder:
You can use the following steps to copy files:
- Run command prompt as an administrator.
- Type the copy command as follows: xcopy c:\sourcefolder c:\targetfolder /h/i/c/k/e/r/y
Explanation of the options:
- /h: Copies hidden and system files, which, xcopyy does not do by default.
- /i: If destination directory does not exist, xcopy creates new directory. Then it copies all files into new directory. It suppresses the prompt to see whether target is a file or directory.
- /c: This parameter ignores errors.
- /k: Retains read-only attribute on target files if it is present on source files. xcopy removes read-only by default.
- /e: This parameter ensures that all the
sub-directories are also copied even though they are empty. - /r: Copies read only files.
- /y: This parameter suppresses prompting to confirm that you want to overwrite an existing destination file.
After running the above command, you will see the TargetFolder as follows: