I'm writing a batch script and need to copy the content of a certain folder to another folder.
For example I have the folder
source/
file1.txt
file2.txt
file3.txt
and I have files in a destination folder. How do I copy the contents of source
into destination
so the final destination would look like this
destination/
existing1.开发者_高级运维txt
existing2.txt
file1.txt
file2.txt
file3.txt
I tried xcopy but can't quite get it right.
Just use wildcards:
xcopy source\*.* destination\*.*
Using wildcards as mentioned above you can easily copy the contents from one file to another.
For example if your source folder and destination folder are on your desktop you could have the following: (substituting the "YOURNAME" with your PC or laptop's name)
@echo off > *.txt
setLocal DisableDelayedExpansion
set dest="C:\Documents and Settings\YOURNAME\Desktop\destination"
xcopy "C:\Documents and Settings\YOURNAME\Desktop\source\*.txt" %dest% /E /I
精彩评论