Reputation: 101
I have 2 folders name FOLDER_ONE
and FOLDER_TWO
,now I want to copy all the files and folders from FOLDER_ONE
and paste them into FOLDER_TWO
and want to rename this FOLDER_TWO
to FOLDER_ONE
.Can any one tell me how can I do this by using vbs ???
Upvotes: 0
Views: 3014
Reputation: 20209
Why not just copy straight to FOLDER_THREE
?
MD FOLDER_THREE
XCOPY FOLDER_ONE\*.* FOLDER_THREE /S
Upvotes: 0
Reputation: 2896
Run the following as a batch file:
move /-y "D:\example\original\*01*.txt" "D:\example\New folder\"
pause
The /-y is used to prompt if there are duplicates, and you can remove it if you don't care about over writing files.
This part "D:\example\original*01.txt"* we are defining the file(s) we will be moving. So in this example this will be any file that has 01 and .txt in its name. You will need to make sure you have the full path with “ “ around it.
This is where "D:\example\New folder\" we will be moving the file to. Once again make sure you have the “ “ around the full path if you have any spaces in the folder names.
Upvotes: 1
Reputation: 354874
In batch files you have a few options depending on your needs:
copy
– good for copying a few files around but better keep it simplexcopy
– better copy allowing copying whole directory trees with complex criteria as to what to copy and what notrobocopy
– similar to xcopy
but with additional emphasis on resilience and automation. Supports theoretically everything that xcopy
does but sometimes with slightly varying semantics.All of those have extensive online help and plenty of examples around the web.
Upvotes: 0