Copy contents of a directory
Thursday, December 27, 2012
If you need to create a batch file in Windows to copy the content of a directory including its subdirectory, you can use 'xcopy'.
xcopy /s c:\source d:\target
These are some of the options you can use with the command
/s/e
- recursive copy, including copying empty directories./v
- add this to verify the copy against the original. slower, but for the paranoid./h
- copy system and hidden files./k
- copy read-only attributes along with files. otherwise, all files become read-write./x
- if you care about permissions, you might want/o
or/x
./y
- don't prompt before overwriting existing files./z
- if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.
0 comments:
Post a Comment