Monday, March 2, 2015

windows 7 - Batch copy multiple folders and their subfolders into a merge folder

I have a folder X:\Export that has several folders:



X:\Export
+---Export1
| \---various files …
+---Export2
| \---… and subfolders
+---Export3
| \---etc.
\---etc. (names vary widely)

Each “Export” folder has the same subdirectory structure, but they have different files (with possibly some name collisions). I would like to copy all the subfolders and the files of X:\Export\Export1, X:\Export\Export2, X:\Export\Export3, etc., to a folder X:\Export\merged, keeping the subdirectory structure.


Pseudocode of what I would like to do but cannot get working properly:


create new folder "merged"
for (every folder X in a given directory Y (i.e., X:\Export)
  copy every file in X keeping directory structure to "merged"
If conflict then overwrite

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...